1 4 5 9 10 package org.openlaszlo.xml.internal; 11 import org.jdom.Element; 12 import java.util.*; 13 14 20 public abstract class Schema { 21 22 23 static Map typeNames = new HashMap(); 24 25 26 public static final Type UNKNOWN_TYPE = newType("unknown"); 27 28 public static final Type STRING_TYPE = newType("string"); 29 30 public static final Type NUMBER_TYPE = newType("number"); 31 32 public static final Type ID_TYPE = newType("ID"); 33 34 35 public static class Type { 36 private String mName; 37 38 public Type(String name) { 39 mName = name; 40 } 41 42 public String toString() { 43 return mName; 44 } 45 } 46 47 50 public static Type newType(String typeName) { 51 Type newtype = new Type(typeName); 52 typeNames.put(typeName, newtype); 53 return newtype; 54 } 55 56 57 public Type getTypeForName (String typeName) { 58 return (Type) typeNames.get(typeName); 59 } 60 61 62 public static final Schema DEFAULT_SCHEMA = 63 new Schema() { 64 65 public Type getAttributeType(Element element, String name) { 66 return UNKNOWN_TYPE; 67 } 68 }; 69 70 78 public abstract Type getAttributeType(Element element, 79 String attributeName); 80 } 81 | Popular Tags |