1. /*
  2. * The Apache Software License, Version 1.1
  3. *
  4. *
  5. * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
  6. * reserved.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions
  10. * are met:
  11. *
  12. * 1. Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. *
  15. * 2. Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in
  17. * the documentation and/or other materials provided with the
  18. * distribution.
  19. *
  20. * 3. The end-user documentation included with the redistribution,
  21. * if any, must include the following acknowledgment:
  22. * "This product includes software developed by the
  23. * Apache Software Foundation (http://www.apache.org/)."
  24. * Alternately, this acknowledgment may appear in the software itself,
  25. * if and wherever such third-party acknowledgments normally appear.
  26. *
  27. * 4. The names "Xerces" and "Apache Software Foundation" must
  28. * not be used to endorse or promote products derived from this
  29. * software without prior written permission. For written
  30. * permission, please contact apache@apache.org.
  31. *
  32. * 5. Products derived from this software may not be called "Apache",
  33. * nor may "Apache" appear in their name, without prior written
  34. * permission of the Apache Software Foundation.
  35. *
  36. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  37. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  38. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  39. * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  40. * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  41. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  42. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  43. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  44. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  45. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  46. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  47. * SUCH DAMAGE.
  48. * ====================================================================
  49. *
  50. * This software consists of voluntary contributions made by many
  51. * individuals on behalf of the Apache Software Foundation and was
  52. * originally based on software copyright (c) 2001, International
  53. * Business Machines, Inc., http://www.apache.org. For more
  54. * information on the Apache Software Foundation, please see
  55. * <http://www.apache.org/>.
  56. */
  57. package com.sun.org.apache.xerces.internal.impl.dv.xs;
  58. import com.sun.org.apache.xerces.internal.impl.dv.SchemaDVFactory;
  59. import com.sun.org.apache.xerces.internal.impl.dv.XSSimpleType;
  60. import com.sun.org.apache.xerces.internal.impl.dv.XSFacets;
  61. import com.sun.org.apache.xerces.internal.impl.xs.XSDeclarationPool;
  62. import com.sun.org.apache.xerces.internal.xs.XSConstants;
  63. import com.sun.org.apache.xerces.internal.xs.XSObjectList;
  64. import com.sun.org.apache.xerces.internal.util.SymbolHash;
  65. /**
  66. * the factory to create/return built-in schema DVs and create user-defined DVs
  67. *
  68. * @author Neeraj Bajaj, Sun Microsystems, inc.
  69. * @author Sandy Gao, IBM
  70. *
  71. * @version $Id: SchemaDVFactoryImpl.java,v 1.14 2003/11/12 23:17:32 sandygao Exp $
  72. */
  73. public class SchemaDVFactoryImpl extends SchemaDVFactory {
  74. static final String URI_SCHEMAFORSCHEMA = "http://www.w3.org/2001/XMLSchema";
  75. static SymbolHash fBuiltInTypes = new SymbolHash();
  76. static {
  77. createBuiltInTypes();
  78. }
  79. protected XSDeclarationPool fDeclPool = null;
  80. /**
  81. * Get a built-in simple type of the given name
  82. * REVISIT: its still not decided within the Schema WG how to define the
  83. * ur-types and if all simple types should be derived from a
  84. * complex type, so as of now we ignore the fact that anySimpleType
  85. * is derived from anyType, and pass 'null' as the base of
  86. * anySimpleType. It needs to be changed as per the decision taken.
  87. *
  88. * @param name the name of the datatype
  89. * @return the datatype validator of the given name
  90. */
  91. public XSSimpleType getBuiltInType(String name) {
  92. return (XSSimpleType)fBuiltInTypes.get(name);
  93. }
  94. /**
  95. * get all built-in simple types, which are stored in a hashtable keyed by
  96. * the name
  97. *
  98. * @return a hashtable which contains all built-in simple types
  99. */
  100. public SymbolHash getBuiltInTypes() {
  101. return (SymbolHash)fBuiltInTypes.makeClone();
  102. }
  103. /**
  104. * Create a new simple type which is derived by restriction from another
  105. * simple type.
  106. *
  107. * @param name name of the new type, could be null
  108. * @param targetNamespace target namespace of the new type, could be null
  109. * @param finalSet value of "final"
  110. * @param base base type of the new type
  111. * @param annotations set of annotations
  112. * @return the newly created simple type
  113. */
  114. public XSSimpleType createTypeRestriction(String name, String targetNamespace,
  115. short finalSet, XSSimpleType base, XSObjectList annotations) {
  116. if (fDeclPool != null) {
  117. XSSimpleTypeDecl st= fDeclPool.getSimpleTypeDecl();
  118. return st.setRestrictionValues((XSSimpleTypeDecl)base, name, targetNamespace, finalSet, annotations);
  119. }
  120. return new XSSimpleTypeDecl((XSSimpleTypeDecl)base, name, targetNamespace, finalSet, false, annotations);
  121. }
  122. /**
  123. * Create a new simple type which is derived by list from another simple
  124. * type.
  125. *
  126. * @param name name of the new type, could be null
  127. * @param targetNamespace target namespace of the new type, could be null
  128. * @param finalSet value of "final"
  129. * @param itemType item type of the list type
  130. * @param annotations set of annotations
  131. * @return the newly created simple type
  132. */
  133. public XSSimpleType createTypeList(String name, String targetNamespace,
  134. short finalSet, XSSimpleType itemType,
  135. XSObjectList annotations) {
  136. if (fDeclPool != null) {
  137. XSSimpleTypeDecl st= fDeclPool.getSimpleTypeDecl();
  138. return st.setListValues(name, targetNamespace, finalSet, (XSSimpleTypeDecl)itemType, annotations);
  139. }
  140. return new XSSimpleTypeDecl(name, targetNamespace, finalSet, (XSSimpleTypeDecl)itemType, false, annotations);
  141. }
  142. /**
  143. * Create a new simple type which is derived by union from a list of other
  144. * simple types.
  145. *
  146. * @param name name of the new type, could be null
  147. * @param targetNamespace target namespace of the new type, could be null
  148. * @param finalSet value of "final"
  149. * @param base member types of the union type
  150. * @param annotations set of annotations
  151. * @return the newly created simple type
  152. */
  153. public XSSimpleType createTypeUnion(String name, String targetNamespace,
  154. short finalSet, XSSimpleType[] memberTypes,
  155. XSObjectList annotations) {
  156. int typeNum = memberTypes.length;
  157. XSSimpleTypeDecl[] mtypes = new XSSimpleTypeDecl[typeNum];
  158. System.arraycopy(memberTypes, 0, mtypes, 0, typeNum);
  159. if (fDeclPool != null) {
  160. XSSimpleTypeDecl st= fDeclPool.getSimpleTypeDecl();
  161. return st.setUnionValues(name, targetNamespace, finalSet, mtypes, annotations);
  162. }
  163. return new XSSimpleTypeDecl(name, targetNamespace, finalSet, mtypes, annotations);
  164. }
  165. // create all built-in types
  166. static void createBuiltInTypes() {
  167. // all schema simple type names
  168. final String ANYSIMPLETYPE = "anySimpleType";
  169. final String ANYURI = "anyURI";
  170. final String BASE64BINARY = "base64Binary";
  171. final String BOOLEAN = "boolean";
  172. final String BYTE = "byte";
  173. final String DATE = "date";
  174. final String DATETIME = "dateTime";
  175. final String DAY = "gDay";
  176. final String DECIMAL = "decimal";
  177. final String DOUBLE = "double";
  178. final String DURATION = "duration";
  179. final String ENTITY = "ENTITY";
  180. final String ENTITIES = "ENTITIES";
  181. final String FLOAT = "float";
  182. final String HEXBINARY = "hexBinary";
  183. final String ID = "ID";
  184. final String IDREF = "IDREF";
  185. final String IDREFS = "IDREFS";
  186. final String INT = "int";
  187. final String INTEGER = "integer";
  188. final String LONG = "long";
  189. final String NAME = "Name";
  190. final String NEGATIVEINTEGER = "negativeInteger";
  191. final String MONTH = "gMonth";
  192. final String MONTHDAY = "gMonthDay";
  193. final String NCNAME = "NCName";
  194. final String NMTOKEN = "NMTOKEN";
  195. final String NMTOKENS = "NMTOKENS";
  196. final String LANGUAGE = "language";
  197. final String NONNEGATIVEINTEGER= "nonNegativeInteger";
  198. final String NONPOSITIVEINTEGER= "nonPositiveInteger";
  199. final String NORMALIZEDSTRING = "normalizedString";
  200. final String NOTATION = "NOTATION";
  201. final String POSITIVEINTEGER = "positiveInteger";
  202. final String QNAME = "QName";
  203. final String SHORT = "short";
  204. final String STRING = "string";
  205. final String TIME = "time";
  206. final String TOKEN = "token";
  207. final String UNSIGNEDBYTE = "unsignedByte";
  208. final String UNSIGNEDINT = "unsignedInt";
  209. final String UNSIGNEDLONG = "unsignedLong";
  210. final String UNSIGNEDSHORT = "unsignedShort";
  211. final String YEAR = "gYear";
  212. final String YEARMONTH = "gYearMonth";
  213. final XSFacets facets = new XSFacets();
  214. //REVISIT: passing "anyType" here.
  215. XSSimpleTypeDecl anySimpleType = XSSimpleTypeDecl.fAnySimpleType;
  216. fBuiltInTypes.put(ANYSIMPLETYPE, anySimpleType);
  217. XSSimpleTypeDecl stringDV = new XSSimpleTypeDecl(anySimpleType, STRING, XSSimpleTypeDecl.DV_STRING, XSSimpleType.ORDERED_FALSE, false, false, false , true, XSConstants.STRING_DT);
  218. fBuiltInTypes.put(STRING, stringDV);
  219. fBuiltInTypes.put(BOOLEAN, new XSSimpleTypeDecl(anySimpleType, BOOLEAN, XSSimpleTypeDecl.DV_BOOLEAN, XSSimpleType.ORDERED_FALSE, false, true, false, true, XSConstants.BOOLEAN_DT));
  220. XSSimpleTypeDecl decimalDV = new XSSimpleTypeDecl(anySimpleType, DECIMAL, XSSimpleTypeDecl.DV_DECIMAL, XSSimpleType.ORDERED_TOTAL, false, false, true, true, XSConstants.DECIMAL_DT);
  221. fBuiltInTypes.put(DECIMAL, decimalDV);
  222. fBuiltInTypes.put(ANYURI, new XSSimpleTypeDecl(anySimpleType, ANYURI, XSSimpleTypeDecl.DV_ANYURI, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.ANYURI_DT));
  223. fBuiltInTypes.put(BASE64BINARY, new XSSimpleTypeDecl(anySimpleType, BASE64BINARY, XSSimpleTypeDecl.DV_BASE64BINARY, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.BASE64BINARY_DT));
  224. fBuiltInTypes.put(DURATION, new XSSimpleTypeDecl(anySimpleType, DURATION, XSSimpleTypeDecl.DV_DURATION, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.DURATION_DT));
  225. fBuiltInTypes.put(DATETIME, new XSSimpleTypeDecl(anySimpleType, DATETIME, XSSimpleTypeDecl.DV_DATETIME, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.DATETIME_DT));
  226. fBuiltInTypes.put(TIME, new XSSimpleTypeDecl(anySimpleType, TIME, XSSimpleTypeDecl.DV_TIME, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.TIME_DT));
  227. fBuiltInTypes.put(DATE, new XSSimpleTypeDecl(anySimpleType, DATE, XSSimpleTypeDecl.DV_DATE, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.DATE_DT));
  228. fBuiltInTypes.put(YEARMONTH, new XSSimpleTypeDecl(anySimpleType, YEARMONTH, XSSimpleTypeDecl.DV_GYEARMONTH, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.GYEARMONTH_DT));
  229. fBuiltInTypes.put(YEAR, new XSSimpleTypeDecl(anySimpleType, YEAR, XSSimpleTypeDecl.DV_GYEAR, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.GYEAR_DT));
  230. fBuiltInTypes.put(MONTHDAY, new XSSimpleTypeDecl(anySimpleType, MONTHDAY, XSSimpleTypeDecl.DV_GMONTHDAY, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.GMONTHDAY_DT));
  231. fBuiltInTypes.put(DAY, new XSSimpleTypeDecl(anySimpleType, DAY, XSSimpleTypeDecl.DV_GDAY, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.GDAY_DT));
  232. fBuiltInTypes.put(MONTH, new XSSimpleTypeDecl(anySimpleType, MONTH, XSSimpleTypeDecl.DV_GMONTH, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.GMONTH_DT));
  233. XSSimpleTypeDecl integerDV = new XSSimpleTypeDecl(decimalDV, INTEGER, XSSimpleTypeDecl.DV_INTEGER, XSSimpleType.ORDERED_TOTAL, false, false, true, true, XSConstants.INTEGER_DT);
  234. fBuiltInTypes.put(INTEGER, integerDV);
  235. facets.maxInclusive = "0";
  236. XSSimpleTypeDecl nonPositiveDV = new XSSimpleTypeDecl(integerDV, NONPOSITIVEINTEGER, URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NONPOSITIVEINTEGER_DT);
  237. nonPositiveDV.applyFacets1(facets , XSSimpleType.FACET_MAXINCLUSIVE, (short)0);
  238. fBuiltInTypes.put(NONPOSITIVEINTEGER, nonPositiveDV);
  239. facets.maxInclusive = "-1";
  240. XSSimpleTypeDecl negativeDV = new XSSimpleTypeDecl(integerDV, NEGATIVEINTEGER, URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NEGATIVEINTEGER_DT);
  241. negativeDV.applyFacets1(facets , XSSimpleType.FACET_MAXINCLUSIVE, (short)0);
  242. fBuiltInTypes.put(NEGATIVEINTEGER, negativeDV);
  243. facets.maxInclusive = "9223372036854775807";
  244. facets.minInclusive = "-9223372036854775808";
  245. XSSimpleTypeDecl longDV = new XSSimpleTypeDecl(integerDV, LONG, URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.LONG_DT);
  246. longDV.applyFacets1(facets , (short)(XSSimpleType.FACET_MAXINCLUSIVE | XSSimpleType.FACET_MININCLUSIVE), (short)0 );
  247. fBuiltInTypes.put(LONG, longDV);
  248. facets.maxInclusive = "2147483647";
  249. facets.minInclusive = "-2147483648";
  250. XSSimpleTypeDecl intDV = new XSSimpleTypeDecl(longDV, INT, URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.INT_DT);
  251. intDV.applyFacets1(facets, (short)(XSSimpleType.FACET_MAXINCLUSIVE | XSSimpleType.FACET_MININCLUSIVE), (short)0 );
  252. fBuiltInTypes.put(INT, intDV);
  253. facets.maxInclusive = "32767";
  254. facets.minInclusive = "-32768";
  255. XSSimpleTypeDecl shortDV = new XSSimpleTypeDecl(intDV, SHORT , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.SHORT_DT);
  256. shortDV.applyFacets1(facets, (short)(XSSimpleType.FACET_MAXINCLUSIVE | XSSimpleType.FACET_MININCLUSIVE), (short)0 );
  257. fBuiltInTypes.put(SHORT, shortDV);
  258. facets.maxInclusive = "127";
  259. facets.minInclusive = "-128";
  260. XSSimpleTypeDecl byteDV = new XSSimpleTypeDecl(shortDV, BYTE , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.BYTE_DT);
  261. byteDV.applyFacets1(facets, (short)(XSSimpleType.FACET_MAXINCLUSIVE | XSSimpleType.FACET_MININCLUSIVE), (short)0 );
  262. fBuiltInTypes.put(BYTE, byteDV);
  263. facets.minInclusive = "0" ;
  264. XSSimpleTypeDecl nonNegativeDV = new XSSimpleTypeDecl(integerDV, NONNEGATIVEINTEGER , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NONNEGATIVEINTEGER_DT);
  265. nonNegativeDV.applyFacets1(facets, XSSimpleType.FACET_MININCLUSIVE, (short)0 );
  266. fBuiltInTypes.put(NONNEGATIVEINTEGER, nonNegativeDV);
  267. facets.maxInclusive = "18446744073709551615" ;
  268. XSSimpleTypeDecl unsignedLongDV = new XSSimpleTypeDecl(nonNegativeDV, UNSIGNEDLONG , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.UNSIGNEDLONG_DT);
  269. unsignedLongDV.applyFacets1(facets, XSSimpleType.FACET_MAXINCLUSIVE, (short)0 );
  270. fBuiltInTypes.put(UNSIGNEDLONG, unsignedLongDV);
  271. facets.maxInclusive = "4294967295" ;
  272. XSSimpleTypeDecl unsignedIntDV = new XSSimpleTypeDecl(unsignedLongDV, UNSIGNEDINT , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.UNSIGNEDINT_DT);
  273. unsignedIntDV.applyFacets1(facets, XSSimpleType.FACET_MAXINCLUSIVE, (short)0 );
  274. fBuiltInTypes.put(UNSIGNEDINT, unsignedIntDV);
  275. facets.maxInclusive = "65535" ;
  276. XSSimpleTypeDecl unsignedShortDV = new XSSimpleTypeDecl(unsignedIntDV, UNSIGNEDSHORT , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.UNSIGNEDSHORT_DT);
  277. unsignedShortDV.applyFacets1(facets, XSSimpleType.FACET_MAXINCLUSIVE, (short)0 );
  278. fBuiltInTypes.put(UNSIGNEDSHORT, unsignedShortDV);
  279. facets.maxInclusive = "255" ;
  280. XSSimpleTypeDecl unsignedByteDV = new XSSimpleTypeDecl(unsignedShortDV, UNSIGNEDBYTE , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.UNSIGNEDBYTE_DT);
  281. unsignedByteDV.applyFacets1(facets, XSSimpleType.FACET_MAXINCLUSIVE, (short)0 );
  282. fBuiltInTypes.put(UNSIGNEDBYTE, unsignedByteDV);
  283. facets.minInclusive = "1" ;
  284. XSSimpleTypeDecl positiveIntegerDV = new XSSimpleTypeDecl(nonNegativeDV, POSITIVEINTEGER , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.POSITIVEINTEGER_DT);
  285. positiveIntegerDV.applyFacets1(facets, XSSimpleType.FACET_MININCLUSIVE, (short)0 );
  286. fBuiltInTypes.put(POSITIVEINTEGER, positiveIntegerDV);
  287. fBuiltInTypes.put(FLOAT, new XSSimpleTypeDecl(anySimpleType, FLOAT, XSSimpleTypeDecl.DV_FLOAT, XSSimpleType.ORDERED_PARTIAL, true, true, true, true, XSConstants.FLOAT_DT));
  288. fBuiltInTypes.put(DOUBLE, new XSSimpleTypeDecl(anySimpleType, DOUBLE, XSSimpleTypeDecl.DV_DOUBLE, XSSimpleType.ORDERED_PARTIAL, true, true, true, true, XSConstants.DOUBLE_DT));
  289. fBuiltInTypes.put(HEXBINARY, new XSSimpleTypeDecl(anySimpleType, HEXBINARY, XSSimpleTypeDecl.DV_HEXBINARY, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.HEXBINARY_DT));
  290. fBuiltInTypes.put(NOTATION, new XSSimpleTypeDecl(anySimpleType, NOTATION, XSSimpleTypeDecl.DV_NOTATION, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.NOTATION_DT));
  291. facets.whiteSpace = XSSimpleType.WS_REPLACE;
  292. XSSimpleTypeDecl normalizedDV = new XSSimpleTypeDecl(stringDV, NORMALIZEDSTRING , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NORMALIZEDSTRING_DT);
  293. normalizedDV.applyFacets1(facets, XSSimpleType.FACET_WHITESPACE, (short)0 );
  294. fBuiltInTypes.put(NORMALIZEDSTRING, normalizedDV);
  295. facets.whiteSpace = XSSimpleType.WS_COLLAPSE;
  296. XSSimpleTypeDecl tokenDV = new XSSimpleTypeDecl(normalizedDV, TOKEN , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.TOKEN_DT);
  297. tokenDV.applyFacets1(facets, XSSimpleType.FACET_WHITESPACE, (short)0 );
  298. fBuiltInTypes.put(TOKEN, tokenDV);
  299. facets.whiteSpace = XSSimpleType.WS_COLLAPSE;
  300. facets.pattern = "([a-zA-Z]{1,8})(-[a-zA-Z0-9]{1,8})*";
  301. XSSimpleTypeDecl languageDV = new XSSimpleTypeDecl(tokenDV, LANGUAGE , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.LANGUAGE_DT);
  302. languageDV.applyFacets1(facets, (short)(XSSimpleType.FACET_WHITESPACE | XSSimpleType.FACET_PATTERN) ,(short)0);
  303. fBuiltInTypes.put(LANGUAGE, languageDV);
  304. facets.whiteSpace = XSSimpleType.WS_COLLAPSE;
  305. XSSimpleTypeDecl nameDV = new XSSimpleTypeDecl(tokenDV, NAME , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NAME_DT);
  306. nameDV.applyFacets1(facets, XSSimpleType.FACET_WHITESPACE, (short)0, XSSimpleTypeDecl.SPECIAL_PATTERN_NAME);
  307. fBuiltInTypes.put(NAME, nameDV);
  308. facets.whiteSpace = XSSimpleType.WS_COLLAPSE;
  309. XSSimpleTypeDecl ncnameDV = new XSSimpleTypeDecl(nameDV, NCNAME , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NCNAME_DT) ;
  310. ncnameDV.applyFacets1(facets, XSSimpleType.FACET_WHITESPACE, (short)0, XSSimpleTypeDecl.SPECIAL_PATTERN_NCNAME);
  311. fBuiltInTypes.put(NCNAME, ncnameDV);
  312. fBuiltInTypes.put(QNAME, new XSSimpleTypeDecl(anySimpleType, QNAME, XSSimpleTypeDecl.DV_QNAME, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.QNAME_DT));
  313. fBuiltInTypes.put(ID, new XSSimpleTypeDecl(ncnameDV, ID, XSSimpleTypeDecl.DV_ID, XSSimpleType.ORDERED_FALSE, false, false, false , true, XSConstants.ID_DT));
  314. XSSimpleTypeDecl idrefDV = new XSSimpleTypeDecl(ncnameDV, IDREF , XSSimpleTypeDecl.DV_IDREF, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.IDREF_DT);
  315. fBuiltInTypes.put(IDREF, idrefDV);
  316. facets.minLength = 1;
  317. XSSimpleTypeDecl tempDV = new XSSimpleTypeDecl(null, URI_SCHEMAFORSCHEMA, (short)0, idrefDV, true, null);
  318. XSSimpleTypeDecl idrefsDV = new XSSimpleTypeDecl(tempDV, IDREFS, URI_SCHEMAFORSCHEMA, (short)0, false, null);
  319. idrefsDV.applyFacets1(facets, XSSimpleType.FACET_MINLENGTH, (short)0);
  320. fBuiltInTypes.put(IDREFS, idrefsDV);
  321. XSSimpleTypeDecl entityDV = new XSSimpleTypeDecl(ncnameDV, ENTITY , XSSimpleTypeDecl.DV_ENTITY, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.ENTITY_DT);
  322. fBuiltInTypes.put(ENTITY, entityDV);
  323. facets.minLength = 1;
  324. tempDV = new XSSimpleTypeDecl(null, URI_SCHEMAFORSCHEMA, (short)0, entityDV, true, null);
  325. XSSimpleTypeDecl entitiesDV = new XSSimpleTypeDecl(tempDV, ENTITIES, URI_SCHEMAFORSCHEMA, (short)0, false, null);
  326. entitiesDV.applyFacets1(facets, XSSimpleType.FACET_MINLENGTH, (short)0);
  327. fBuiltInTypes.put(ENTITIES, entitiesDV);
  328. facets.whiteSpace = XSSimpleType.WS_COLLAPSE;
  329. XSSimpleTypeDecl nmtokenDV = new XSSimpleTypeDecl(tokenDV, NMTOKEN, URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NMTOKEN_DT);
  330. nmtokenDV.applyFacets1(facets, XSSimpleType.FACET_WHITESPACE, (short)0, XSSimpleTypeDecl.SPECIAL_PATTERN_NMTOKEN);
  331. fBuiltInTypes.put(NMTOKEN, nmtokenDV);
  332. facets.minLength = 1;
  333. tempDV = new XSSimpleTypeDecl(null, URI_SCHEMAFORSCHEMA, (short)0, nmtokenDV, true, null);
  334. XSSimpleTypeDecl nmtokensDV = new XSSimpleTypeDecl(tempDV, NMTOKENS, URI_SCHEMAFORSCHEMA, (short)0, false, null);
  335. nmtokensDV.applyFacets1(facets, XSSimpleType.FACET_MINLENGTH, (short)0);
  336. fBuiltInTypes.put(NMTOKENS, nmtokensDV);
  337. }//createBuiltInTypes()
  338. public void setDeclPool (XSDeclarationPool declPool){
  339. fDeclPool = declPool;
  340. }
  341. }//SchemaDVFactoryImpl