1 57 58 package com.sun.org.apache.xerces.internal.impl.dv.xs; 59 60 import com.sun.org.apache.xerces.internal.impl.dv.XSSimpleType; 61 import com.sun.org.apache.xerces.internal.impl.dv.XSFacets; 62 import com.sun.org.apache.xerces.internal.util.SymbolHash; 63 import com.sun.org.apache.xerces.internal.xs.XSConstants; 64 65 73 public class FullDVFactory extends BaseDVFactory { 74 75 static final String URI_SCHEMAFORSCHEMA = "http://www.w3.org/2001/XMLSchema"; 76 77 static SymbolHash fFullTypes = new SymbolHash(89); 79 static { 80 createBuiltInTypes(fFullTypes); 81 } 82 83 94 public XSSimpleType getBuiltInType(String name) { 95 return (XSSimpleType)fFullTypes.get(name); 96 } 97 98 104 public SymbolHash getBuiltInTypes() { 105 return (SymbolHash)fFullTypes.makeClone(); 106 } 107 108 static void createBuiltInTypes(SymbolHash types) { 110 BaseDVFactory.createBuiltInTypes(types); 112 113 final String DOUBLE = "double"; 115 final String DURATION = "duration"; 116 final String ENTITY = "ENTITY"; 117 final String ENTITIES = "ENTITIES"; 118 final String FLOAT = "float"; 119 final String HEXBINARY = "hexBinary"; 120 final String ID = "ID"; 121 final String IDREF = "IDREF"; 122 final String IDREFS = "IDREFS"; 123 final String NAME = "Name"; 124 final String NCNAME = "NCName"; 125 final String NMTOKEN = "NMTOKEN"; 126 final String NMTOKENS = "NMTOKENS"; 127 final String LANGUAGE = "language"; 128 final String NORMALIZEDSTRING = "normalizedString"; 129 final String NOTATION = "NOTATION"; 130 final String QNAME = "QName"; 131 final String STRING = "string"; 132 final String TOKEN = "token"; 133 134 final XSFacets facets = new XSFacets(); 135 136 XSSimpleTypeDecl anySimpleType = XSSimpleTypeDecl.fAnySimpleType; 137 XSSimpleTypeDecl stringDV = (XSSimpleTypeDecl)types.get(STRING); 138 139 types.put(FLOAT, new XSSimpleTypeDecl(anySimpleType, FLOAT, XSSimpleTypeDecl.DV_FLOAT, XSSimpleType.ORDERED_PARTIAL, true, true, true, true, XSConstants.FLOAT_DT)); 140 types.put(DOUBLE, new XSSimpleTypeDecl(anySimpleType, DOUBLE, XSSimpleTypeDecl.DV_DOUBLE, XSSimpleType.ORDERED_PARTIAL, true, true, true, true, XSConstants.DOUBLE_DT)); 141 types.put(DURATION, new XSSimpleTypeDecl(anySimpleType, DURATION, XSSimpleTypeDecl.DV_DURATION, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.DURATION_DT)); 142 types.put(HEXBINARY, new XSSimpleTypeDecl(anySimpleType, HEXBINARY, XSSimpleTypeDecl.DV_HEXBINARY, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.HEXBINARY_DT)); 143 types.put(QNAME, new XSSimpleTypeDecl(anySimpleType, QNAME, XSSimpleTypeDecl.DV_QNAME, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.QNAME_DT)); 144 types.put(NOTATION, new XSSimpleTypeDecl(anySimpleType, NOTATION, XSSimpleTypeDecl.DV_NOTATION, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.NOTATION_DT)); 145 146 facets.whiteSpace = XSSimpleType.WS_REPLACE; 147 XSSimpleTypeDecl normalizedDV = new XSSimpleTypeDecl(stringDV, NORMALIZEDSTRING , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NORMALIZEDSTRING_DT); 148 normalizedDV.applyFacets1(facets, XSSimpleType.FACET_WHITESPACE, (short)0 ); 149 types.put(NORMALIZEDSTRING, normalizedDV); 150 151 facets.whiteSpace = XSSimpleType.WS_COLLAPSE; 152 XSSimpleTypeDecl tokenDV = new XSSimpleTypeDecl(normalizedDV, TOKEN , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.TOKEN_DT); 153 tokenDV.applyFacets1(facets, XSSimpleType.FACET_WHITESPACE, (short)0 ); 154 types.put(TOKEN, tokenDV); 155 156 facets.whiteSpace = XSSimpleType.WS_COLLAPSE; 157 facets.pattern = "([a-zA-Z]{1,8})(-[a-zA-Z0-9]{1,8})*"; 158 XSSimpleTypeDecl languageDV = new XSSimpleTypeDecl(tokenDV, LANGUAGE , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.LANGUAGE_DT); 159 languageDV.applyFacets1(facets, (short)(XSSimpleType.FACET_WHITESPACE | XSSimpleType.FACET_PATTERN) ,(short)0); 160 types.put(LANGUAGE, languageDV); 161 162 facets.whiteSpace = XSSimpleType.WS_COLLAPSE; 163 XSSimpleTypeDecl nameDV = new XSSimpleTypeDecl(tokenDV, NAME , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NAME_DT); 164 nameDV.applyFacets1(facets, XSSimpleType.FACET_WHITESPACE, (short)0, XSSimpleTypeDecl.SPECIAL_PATTERN_NAME); 165 types.put(NAME, nameDV); 166 167 facets.whiteSpace = XSSimpleType.WS_COLLAPSE; 168 XSSimpleTypeDecl ncnameDV = new XSSimpleTypeDecl(nameDV, NCNAME , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NCNAME_DT) ; 169 ncnameDV.applyFacets1(facets, XSSimpleType.FACET_WHITESPACE, (short)0, XSSimpleTypeDecl.SPECIAL_PATTERN_NCNAME); 170 types.put(NCNAME, ncnameDV); 171 172 types.put(ID, new XSSimpleTypeDecl(ncnameDV, ID, XSSimpleTypeDecl.DV_ID, XSSimpleType.ORDERED_FALSE, false, false, false , true, XSConstants.ID_DT)); 173 XSSimpleTypeDecl idrefDV = new XSSimpleTypeDecl(ncnameDV, IDREF , XSSimpleTypeDecl.DV_IDREF, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.IDREF_DT); 174 types.put(IDREF, idrefDV); 175 176 facets.minLength = 1; 177 XSSimpleTypeDecl tempDV = new XSSimpleTypeDecl(null, URI_SCHEMAFORSCHEMA, (short)0, idrefDV, true, null); 178 XSSimpleTypeDecl idrefsDV = new XSSimpleTypeDecl(tempDV, IDREFS, URI_SCHEMAFORSCHEMA, (short)0, false, null); 179 idrefsDV.applyFacets1(facets, XSSimpleType.FACET_MINLENGTH, (short)0); 180 types.put(IDREFS, idrefsDV); 181 182 XSSimpleTypeDecl entityDV = new XSSimpleTypeDecl(ncnameDV, ENTITY , XSSimpleTypeDecl.DV_ENTITY, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.ENTITY_DT); 183 types.put(ENTITY, entityDV); 184 185 facets.minLength = 1; 186 tempDV = new XSSimpleTypeDecl(null, URI_SCHEMAFORSCHEMA, (short)0, entityDV, true, null); 187 XSSimpleTypeDecl entitiesDV = new XSSimpleTypeDecl(tempDV, ENTITIES, URI_SCHEMAFORSCHEMA, (short)0, false, null); 188 entitiesDV.applyFacets1(facets, XSSimpleType.FACET_MINLENGTH, (short)0); 189 types.put(ENTITIES, entitiesDV); 190 191 192 facets.whiteSpace = XSSimpleType.WS_COLLAPSE; 193 XSSimpleTypeDecl nmtokenDV = new XSSimpleTypeDecl(tokenDV, NMTOKEN, URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NMTOKEN_DT); 194 nmtokenDV.applyFacets1(facets, XSSimpleType.FACET_WHITESPACE, (short)0, XSSimpleTypeDecl.SPECIAL_PATTERN_NMTOKEN); 195 types.put(NMTOKEN, nmtokenDV); 196 197 facets.minLength = 1; 198 tempDV = new XSSimpleTypeDecl(null, URI_SCHEMAFORSCHEMA, (short)0, nmtokenDV, true, null); 199 XSSimpleTypeDecl nmtokensDV = new XSSimpleTypeDecl(tempDV, NMTOKENS, URI_SCHEMAFORSCHEMA, (short)0, false, null); 200 nmtokensDV.applyFacets1(facets, XSSimpleType.FACET_MINLENGTH, (short)0); 201 types.put(NMTOKENS, nmtokensDV); 202 } 204 } | Popular Tags |