KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > impl > dv > xs > SchemaDVFactoryImpl


1 /*
2  * Copyright 2001-2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.xerces.impl.dv.xs;
18
19 import org.apache.xerces.impl.Constants;
20 import org.apache.xerces.impl.dv.SchemaDVFactory;
21 import org.apache.xerces.impl.dv.XSFacets;
22 import org.apache.xerces.impl.dv.XSSimpleType;
23 import org.apache.xerces.impl.xs.XSDeclarationPool;
24 import org.apache.xerces.util.SymbolHash;
25 import org.apache.xerces.xs.XSConstants;
26 import org.apache.xerces.xs.XSObjectList;
27
28 /**
29  * the factory to create/return built-in schema DVs and create user-defined DVs
30  *
31  * @xerces.internal
32  *
33  * @author Neeraj Bajaj, Sun Microsystems, inc.
34  * @author Sandy Gao, IBM
35  *
36  * @version $Id: SchemaDVFactoryImpl.java,v 1.20 2005/06/13 04:55:30 mrglavas Exp $
37  */

38 public class SchemaDVFactoryImpl extends SchemaDVFactory {
39
40     static final String JavaDoc URI_SCHEMAFORSCHEMA = "http://www.w3.org/2001/XMLSchema";
41
42     static SymbolHash fBuiltInTypes = new SymbolHash();
43     static {
44         createBuiltInTypes();
45     }
46
47     protected XSDeclarationPool fDeclPool = null;
48
49     /**
50      * Get a built-in simple type of the given name
51      * REVISIT: its still not decided within the Schema WG how to define the
52      * ur-types and if all simple types should be derived from a
53      * complex type, so as of now we ignore the fact that anySimpleType
54      * is derived from anyType, and pass 'null' as the base of
55      * anySimpleType. It needs to be changed as per the decision taken.
56      *
57      * @param name the name of the datatype
58      * @return the datatype validator of the given name
59      */

60     public XSSimpleType getBuiltInType(String JavaDoc name) {
61         return (XSSimpleType)fBuiltInTypes.get(name);
62     }
63
64     /**
65      * get all built-in simple types, which are stored in a hashtable keyed by
66      * the name
67      *
68      * @return a hashtable which contains all built-in simple types
69      */

70     public SymbolHash getBuiltInTypes() {
71         return (SymbolHash)fBuiltInTypes.makeClone();
72     }
73
74     /**
75      * Create a new simple type which is derived by restriction from another
76      * simple type.
77      *
78      * @param name name of the new type, could be null
79      * @param targetNamespace target namespace of the new type, could be null
80      * @param finalSet value of "final"
81      * @param base base type of the new type
82      * @param annotations set of annotations
83      * @return the newly created simple type
84      */

85     public XSSimpleType createTypeRestriction(String JavaDoc name, String JavaDoc targetNamespace,
86                                               short finalSet, XSSimpleType base, XSObjectList annotations) {
87         
88         if (fDeclPool != null) {
89            XSSimpleTypeDecl st= fDeclPool.getSimpleTypeDecl();
90            return st.setRestrictionValues((XSSimpleTypeDecl)base, name, targetNamespace, finalSet, annotations);
91         }
92         return new XSSimpleTypeDecl((XSSimpleTypeDecl)base, name, targetNamespace, finalSet, false, annotations);
93     }
94
95     /**
96      * Create a new simple type which is derived by list from another simple
97      * type.
98      *
99      * @param name name of the new type, could be null
100      * @param targetNamespace target namespace of the new type, could be null
101      * @param finalSet value of "final"
102      * @param itemType item type of the list type
103      * @param annotations set of annotations
104      * @return the newly created simple type
105      */

106     public XSSimpleType createTypeList(String JavaDoc name, String JavaDoc targetNamespace,
107                                        short finalSet, XSSimpleType itemType,
108                                        XSObjectList annotations) {
109         if (fDeclPool != null) {
110            XSSimpleTypeDecl st= fDeclPool.getSimpleTypeDecl();
111            return st.setListValues(name, targetNamespace, finalSet, (XSSimpleTypeDecl)itemType, annotations);
112         }
113         return new XSSimpleTypeDecl(name, targetNamespace, finalSet, (XSSimpleTypeDecl)itemType, false, annotations);
114     }
115
116     /**
117      * Create a new simple type which is derived by union from a list of other
118      * simple types.
119      *
120      * @param name name of the new type, could be null
121      * @param targetNamespace target namespace of the new type, could be null
122      * @param finalSet value of "final"
123      * @param memberTypes member types of the union type
124      * @param annotations set of annotations
125      * @return the newly created simple type
126      */

127     public XSSimpleType createTypeUnion(String JavaDoc name, String JavaDoc targetNamespace,
128                                         short finalSet, XSSimpleType[] memberTypes,
129                                         XSObjectList annotations) {
130         int typeNum = memberTypes.length;
131         XSSimpleTypeDecl[] mtypes = new XSSimpleTypeDecl[typeNum];
132         System.arraycopy(memberTypes, 0, mtypes, 0, typeNum);
133
134         if (fDeclPool != null) {
135            XSSimpleTypeDecl st= fDeclPool.getSimpleTypeDecl();
136            return st.setUnionValues(name, targetNamespace, finalSet, mtypes, annotations);
137         }
138         return new XSSimpleTypeDecl(name, targetNamespace, finalSet, mtypes, annotations);
139     }
140
141     // create all built-in types
142
static void createBuiltInTypes() {
143         // all schema simple type names
144
final String JavaDoc ANYSIMPLETYPE = "anySimpleType";
145         final String JavaDoc ANYATOMICTYPE = "anyAtomicType";
146         final String JavaDoc ANYURI = "anyURI";
147         final String JavaDoc BASE64BINARY = "base64Binary";
148         final String JavaDoc BOOLEAN = "boolean";
149         final String JavaDoc BYTE = "byte";
150         final String JavaDoc DATE = "date";
151         final String JavaDoc DATETIME = "dateTime";
152         final String JavaDoc DAY = "gDay";
153         final String JavaDoc DECIMAL = "decimal";
154         final String JavaDoc DOUBLE = "double";
155         final String JavaDoc DURATION = "duration";
156         final String JavaDoc ENTITY = "ENTITY";
157         final String JavaDoc ENTITIES = "ENTITIES";
158         final String JavaDoc FLOAT = "float";
159         final String JavaDoc HEXBINARY = "hexBinary";
160         final String JavaDoc ID = "ID";
161         final String JavaDoc IDREF = "IDREF";
162         final String JavaDoc IDREFS = "IDREFS";
163         final String JavaDoc INT = "int";
164         final String JavaDoc INTEGER = "integer";
165         final String JavaDoc LONG = "long";
166         final String JavaDoc NAME = "Name";
167         final String JavaDoc NEGATIVEINTEGER = "negativeInteger";
168         final String JavaDoc MONTH = "gMonth";
169         final String JavaDoc MONTHDAY = "gMonthDay";
170         final String JavaDoc NCNAME = "NCName";
171         final String JavaDoc NMTOKEN = "NMTOKEN";
172         final String JavaDoc NMTOKENS = "NMTOKENS";
173         final String JavaDoc LANGUAGE = "language";
174         final String JavaDoc NONNEGATIVEINTEGER= "nonNegativeInteger";
175         final String JavaDoc NONPOSITIVEINTEGER= "nonPositiveInteger";
176         final String JavaDoc NORMALIZEDSTRING = "normalizedString";
177         final String JavaDoc NOTATION = "NOTATION";
178         final String JavaDoc POSITIVEINTEGER = "positiveInteger";
179         final String JavaDoc QNAME = "QName";
180         final String JavaDoc SHORT = "short";
181         final String JavaDoc STRING = "string";
182         final String JavaDoc TIME = "time";
183         final String JavaDoc TOKEN = "token";
184         final String JavaDoc UNSIGNEDBYTE = "unsignedByte";
185         final String JavaDoc UNSIGNEDINT = "unsignedInt";
186         final String JavaDoc UNSIGNEDLONG = "unsignedLong";
187         final String JavaDoc UNSIGNEDSHORT = "unsignedShort";
188         final String JavaDoc YEAR = "gYear";
189         final String JavaDoc YEARMONTH = "gYearMonth";
190         final String JavaDoc YEARMONTHDURATION = "yearMonthDuration";
191         final String JavaDoc DAYTIMEDURATION = "dayTimeDuration";
192         final String JavaDoc PRECISIONDECIMAL = "precisionDecimal";
193
194         final XSFacets facets = new XSFacets();
195
196         //REVISIT: passing "anyType" here.
197
XSSimpleTypeDecl anySimpleType = XSSimpleTypeDecl.fAnySimpleType;
198         XSSimpleTypeDecl anyAtomicType = XSSimpleTypeDecl.fAnyAtomicType;
199         XSSimpleTypeDecl baseAtomicType = null;
200         
201         if (Constants.SCHEMA_1_1_SUPPORT) {
202             baseAtomicType = anyAtomicType;
203             fBuiltInTypes.put(ANYATOMICTYPE, anyAtomicType);
204         }
205         else {
206             baseAtomicType = anySimpleType;
207         }
208         
209         fBuiltInTypes.put(ANYSIMPLETYPE, anySimpleType);
210         XSSimpleTypeDecl stringDV = new XSSimpleTypeDecl(baseAtomicType, STRING, XSSimpleTypeDecl.DV_STRING, XSSimpleType.ORDERED_FALSE, false, false, false , true, XSConstants.STRING_DT);
211         fBuiltInTypes.put(STRING, stringDV);
212         fBuiltInTypes.put(BOOLEAN, new XSSimpleTypeDecl(baseAtomicType, BOOLEAN, XSSimpleTypeDecl.DV_BOOLEAN, XSSimpleType.ORDERED_FALSE, false, true, false, true, XSConstants.BOOLEAN_DT));
213         XSSimpleTypeDecl decimalDV = new XSSimpleTypeDecl(baseAtomicType, DECIMAL, XSSimpleTypeDecl.DV_DECIMAL, XSSimpleType.ORDERED_TOTAL, false, false, true, true, XSConstants.DECIMAL_DT);
214         fBuiltInTypes.put(DECIMAL, decimalDV);
215
216         fBuiltInTypes.put(ANYURI, new XSSimpleTypeDecl(baseAtomicType, ANYURI, XSSimpleTypeDecl.DV_ANYURI, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.ANYURI_DT));
217         fBuiltInTypes.put(BASE64BINARY, new XSSimpleTypeDecl(baseAtomicType, BASE64BINARY, XSSimpleTypeDecl.DV_BASE64BINARY, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.BASE64BINARY_DT));
218         
219         XSSimpleTypeDecl durationDV = new XSSimpleTypeDecl(baseAtomicType, DURATION, XSSimpleTypeDecl.DV_DURATION, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.DURATION_DT);
220         fBuiltInTypes.put(DURATION, durationDV);
221         
222         if (Constants.SCHEMA_1_1_SUPPORT) {
223             fBuiltInTypes.put(YEARMONTHDURATION, new XSSimpleTypeDecl(durationDV, YEARMONTHDURATION, XSSimpleTypeDecl.DV_YEARMONTHDURATION, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSSimpleTypeDecl.YEARMONTHDURATION_DT));
224             fBuiltInTypes.put(DAYTIMEDURATION, new XSSimpleTypeDecl(durationDV, DAYTIMEDURATION, XSSimpleTypeDecl.DV_DAYTIMEDURATION, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSSimpleTypeDecl.DAYTIMEDURATION_DT));
225             fBuiltInTypes.put(PRECISIONDECIMAL, new XSSimpleTypeDecl(anySimpleType, PRECISIONDECIMAL, XSSimpleTypeDecl.DV_PRECISIONDECIMAL, XSSimpleType.ORDERED_PARTIAL, false, false, true, true, XSSimpleTypeDecl.PRECISIONDECIMAL_DT));
226         }
227         
228         fBuiltInTypes.put(DATETIME, new XSSimpleTypeDecl(baseAtomicType, DATETIME, XSSimpleTypeDecl.DV_DATETIME, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.DATETIME_DT));
229         fBuiltInTypes.put(TIME, new XSSimpleTypeDecl(baseAtomicType, TIME, XSSimpleTypeDecl.DV_TIME, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.TIME_DT));
230         fBuiltInTypes.put(DATE, new XSSimpleTypeDecl(baseAtomicType, DATE, XSSimpleTypeDecl.DV_DATE, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.DATE_DT));
231         fBuiltInTypes.put(YEARMONTH, new XSSimpleTypeDecl(baseAtomicType, YEARMONTH, XSSimpleTypeDecl.DV_GYEARMONTH, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.GYEARMONTH_DT));
232         fBuiltInTypes.put(YEAR, new XSSimpleTypeDecl(baseAtomicType, YEAR, XSSimpleTypeDecl.DV_GYEAR, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.GYEAR_DT));
233         fBuiltInTypes.put(MONTHDAY, new XSSimpleTypeDecl(baseAtomicType, MONTHDAY, XSSimpleTypeDecl.DV_GMONTHDAY, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.GMONTHDAY_DT));
234         fBuiltInTypes.put(DAY, new XSSimpleTypeDecl(baseAtomicType, DAY, XSSimpleTypeDecl.DV_GDAY, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.GDAY_DT));
235         fBuiltInTypes.put(MONTH, new XSSimpleTypeDecl(baseAtomicType, MONTH, XSSimpleTypeDecl.DV_GMONTH, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.GMONTH_DT));
236
237         XSSimpleTypeDecl integerDV = new XSSimpleTypeDecl(decimalDV, INTEGER, XSSimpleTypeDecl.DV_INTEGER, XSSimpleType.ORDERED_TOTAL, false, false, true, true, XSConstants.INTEGER_DT);
238         fBuiltInTypes.put(INTEGER, integerDV);
239
240         facets.maxInclusive = "0";
241         XSSimpleTypeDecl nonPositiveDV = new XSSimpleTypeDecl(integerDV, NONPOSITIVEINTEGER, URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NONPOSITIVEINTEGER_DT);
242         nonPositiveDV.applyFacets1(facets , XSSimpleType.FACET_MAXINCLUSIVE, (short)0);
243         fBuiltInTypes.put(NONPOSITIVEINTEGER, nonPositiveDV);
244
245         facets.maxInclusive = "-1";
246         XSSimpleTypeDecl negativeDV = new XSSimpleTypeDecl(integerDV, NEGATIVEINTEGER, URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NEGATIVEINTEGER_DT);
247         negativeDV.applyFacets1(facets , XSSimpleType.FACET_MAXINCLUSIVE, (short)0);
248         fBuiltInTypes.put(NEGATIVEINTEGER, negativeDV);
249
250         facets.maxInclusive = "9223372036854775807";
251         facets.minInclusive = "-9223372036854775808";
252         XSSimpleTypeDecl longDV = new XSSimpleTypeDecl(integerDV, LONG, URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.LONG_DT);
253         longDV.applyFacets1(facets , (short)(XSSimpleType.FACET_MAXINCLUSIVE | XSSimpleType.FACET_MININCLUSIVE), (short)0 );
254         fBuiltInTypes.put(LONG, longDV);
255
256
257         facets.maxInclusive = "2147483647";
258         facets.minInclusive = "-2147483648";
259         XSSimpleTypeDecl intDV = new XSSimpleTypeDecl(longDV, INT, URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.INT_DT);
260         intDV.applyFacets1(facets, (short)(XSSimpleType.FACET_MAXINCLUSIVE | XSSimpleType.FACET_MININCLUSIVE), (short)0 );
261         fBuiltInTypes.put(INT, intDV);
262
263         facets.maxInclusive = "32767";
264         facets.minInclusive = "-32768";
265         XSSimpleTypeDecl shortDV = new XSSimpleTypeDecl(intDV, SHORT , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.SHORT_DT);
266         shortDV.applyFacets1(facets, (short)(XSSimpleType.FACET_MAXINCLUSIVE | XSSimpleType.FACET_MININCLUSIVE), (short)0 );
267         fBuiltInTypes.put(SHORT, shortDV);
268
269         facets.maxInclusive = "127";
270         facets.minInclusive = "-128";
271         XSSimpleTypeDecl byteDV = new XSSimpleTypeDecl(shortDV, BYTE , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.BYTE_DT);
272         byteDV.applyFacets1(facets, (short)(XSSimpleType.FACET_MAXINCLUSIVE | XSSimpleType.FACET_MININCLUSIVE), (short)0 );
273         fBuiltInTypes.put(BYTE, byteDV);
274
275         facets.minInclusive = "0" ;
276         XSSimpleTypeDecl nonNegativeDV = new XSSimpleTypeDecl(integerDV, NONNEGATIVEINTEGER , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NONNEGATIVEINTEGER_DT);
277         nonNegativeDV.applyFacets1(facets, XSSimpleType.FACET_MININCLUSIVE, (short)0 );
278         fBuiltInTypes.put(NONNEGATIVEINTEGER, nonNegativeDV);
279
280         facets.maxInclusive = "18446744073709551615" ;
281         XSSimpleTypeDecl unsignedLongDV = new XSSimpleTypeDecl(nonNegativeDV, UNSIGNEDLONG , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.UNSIGNEDLONG_DT);
282         unsignedLongDV.applyFacets1(facets, XSSimpleType.FACET_MAXINCLUSIVE, (short)0 );
283         fBuiltInTypes.put(UNSIGNEDLONG, unsignedLongDV);
284
285         facets.maxInclusive = "4294967295" ;
286         XSSimpleTypeDecl unsignedIntDV = new XSSimpleTypeDecl(unsignedLongDV, UNSIGNEDINT , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.UNSIGNEDINT_DT);
287         unsignedIntDV.applyFacets1(facets, XSSimpleType.FACET_MAXINCLUSIVE, (short)0 );
288         fBuiltInTypes.put(UNSIGNEDINT, unsignedIntDV);
289
290         facets.maxInclusive = "65535" ;
291         XSSimpleTypeDecl unsignedShortDV = new XSSimpleTypeDecl(unsignedIntDV, UNSIGNEDSHORT , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.UNSIGNEDSHORT_DT);
292         unsignedShortDV.applyFacets1(facets, XSSimpleType.FACET_MAXINCLUSIVE, (short)0 );
293         fBuiltInTypes.put(UNSIGNEDSHORT, unsignedShortDV);
294
295         facets.maxInclusive = "255" ;
296         XSSimpleTypeDecl unsignedByteDV = new XSSimpleTypeDecl(unsignedShortDV, UNSIGNEDBYTE , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.UNSIGNEDBYTE_DT);
297         unsignedByteDV.applyFacets1(facets, XSSimpleType.FACET_MAXINCLUSIVE, (short)0 );
298         fBuiltInTypes.put(UNSIGNEDBYTE, unsignedByteDV);
299
300         facets.minInclusive = "1" ;
301         XSSimpleTypeDecl positiveIntegerDV = new XSSimpleTypeDecl(nonNegativeDV, POSITIVEINTEGER , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.POSITIVEINTEGER_DT);
302         positiveIntegerDV.applyFacets1(facets, XSSimpleType.FACET_MININCLUSIVE, (short)0 );
303         fBuiltInTypes.put(POSITIVEINTEGER, positiveIntegerDV);
304
305
306         fBuiltInTypes.put(FLOAT, new XSSimpleTypeDecl(baseAtomicType, FLOAT, XSSimpleTypeDecl.DV_FLOAT, XSSimpleType.ORDERED_PARTIAL, true, true, true, true, XSConstants.FLOAT_DT));
307         fBuiltInTypes.put(DOUBLE, new XSSimpleTypeDecl(baseAtomicType, DOUBLE, XSSimpleTypeDecl.DV_DOUBLE, XSSimpleType.ORDERED_PARTIAL, true, true, true, true, XSConstants.DOUBLE_DT));
308         fBuiltInTypes.put(HEXBINARY, new XSSimpleTypeDecl(baseAtomicType, HEXBINARY, XSSimpleTypeDecl.DV_HEXBINARY, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.HEXBINARY_DT));
309         fBuiltInTypes.put(NOTATION, new XSSimpleTypeDecl(baseAtomicType, NOTATION, XSSimpleTypeDecl.DV_NOTATION, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.NOTATION_DT));
310
311
312         facets.whiteSpace = XSSimpleType.WS_REPLACE;
313         XSSimpleTypeDecl normalizedDV = new XSSimpleTypeDecl(stringDV, NORMALIZEDSTRING , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NORMALIZEDSTRING_DT);
314         normalizedDV.applyFacets1(facets, XSSimpleType.FACET_WHITESPACE, (short)0 );
315         fBuiltInTypes.put(NORMALIZEDSTRING, normalizedDV);
316
317         facets.whiteSpace = XSSimpleType.WS_COLLAPSE;
318         XSSimpleTypeDecl tokenDV = new XSSimpleTypeDecl(normalizedDV, TOKEN , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.TOKEN_DT);
319         tokenDV.applyFacets1(facets, XSSimpleType.FACET_WHITESPACE, (short)0 );
320         fBuiltInTypes.put(TOKEN, tokenDV);
321
322         facets.whiteSpace = XSSimpleType.WS_COLLAPSE;
323         facets.pattern = "([a-zA-Z]{1,8})(-[a-zA-Z0-9]{1,8})*";
324         XSSimpleTypeDecl languageDV = new XSSimpleTypeDecl(tokenDV, LANGUAGE , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.LANGUAGE_DT);
325         languageDV.applyFacets1(facets, (short)(XSSimpleType.FACET_WHITESPACE | XSSimpleType.FACET_PATTERN) ,(short)0);
326         fBuiltInTypes.put(LANGUAGE, languageDV);
327
328
329         facets.whiteSpace = XSSimpleType.WS_COLLAPSE;
330         XSSimpleTypeDecl nameDV = new XSSimpleTypeDecl(tokenDV, NAME , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NAME_DT);
331         nameDV.applyFacets1(facets, XSSimpleType.FACET_WHITESPACE, (short)0, XSSimpleTypeDecl.SPECIAL_PATTERN_NAME);
332         fBuiltInTypes.put(NAME, nameDV);
333
334         facets.whiteSpace = XSSimpleType.WS_COLLAPSE;
335         XSSimpleTypeDecl ncnameDV = new XSSimpleTypeDecl(nameDV, NCNAME , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NCNAME_DT) ;
336         ncnameDV.applyFacets1(facets, XSSimpleType.FACET_WHITESPACE, (short)0, XSSimpleTypeDecl.SPECIAL_PATTERN_NCNAME);
337         fBuiltInTypes.put(NCNAME, ncnameDV);
338
339         fBuiltInTypes.put(QNAME, new XSSimpleTypeDecl(baseAtomicType, QNAME, XSSimpleTypeDecl.DV_QNAME, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.QNAME_DT));
340
341         fBuiltInTypes.put(ID, new XSSimpleTypeDecl(ncnameDV, ID, XSSimpleTypeDecl.DV_ID, XSSimpleType.ORDERED_FALSE, false, false, false , true, XSConstants.ID_DT));
342         XSSimpleTypeDecl idrefDV = new XSSimpleTypeDecl(ncnameDV, IDREF , XSSimpleTypeDecl.DV_IDREF, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.IDREF_DT);
343         fBuiltInTypes.put(IDREF, idrefDV);
344
345         facets.minLength = 1;
346         XSSimpleTypeDecl tempDV = new XSSimpleTypeDecl(null, URI_SCHEMAFORSCHEMA, (short)0, idrefDV, true, null);
347         XSSimpleTypeDecl idrefsDV = new XSSimpleTypeDecl(tempDV, IDREFS, URI_SCHEMAFORSCHEMA, (short)0, false, null);
348         idrefsDV.applyFacets1(facets, XSSimpleType.FACET_MINLENGTH, (short)0);
349         fBuiltInTypes.put(IDREFS, idrefsDV);
350
351         XSSimpleTypeDecl entityDV = new XSSimpleTypeDecl(ncnameDV, ENTITY , XSSimpleTypeDecl.DV_ENTITY, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.ENTITY_DT);
352         fBuiltInTypes.put(ENTITY, entityDV);
353
354         facets.minLength = 1;
355         tempDV = new XSSimpleTypeDecl(null, URI_SCHEMAFORSCHEMA, (short)0, entityDV, true, null);
356         XSSimpleTypeDecl entitiesDV = new XSSimpleTypeDecl(tempDV, ENTITIES, URI_SCHEMAFORSCHEMA, (short)0, false, null);
357         entitiesDV.applyFacets1(facets, XSSimpleType.FACET_MINLENGTH, (short)0);
358         fBuiltInTypes.put(ENTITIES, entitiesDV);
359
360
361         facets.whiteSpace = XSSimpleType.WS_COLLAPSE;
362         XSSimpleTypeDecl nmtokenDV = new XSSimpleTypeDecl(tokenDV, NMTOKEN, URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NMTOKEN_DT);
363         nmtokenDV.applyFacets1(facets, XSSimpleType.FACET_WHITESPACE, (short)0, XSSimpleTypeDecl.SPECIAL_PATTERN_NMTOKEN);
364         fBuiltInTypes.put(NMTOKEN, nmtokenDV);
365
366         facets.minLength = 1;
367         tempDV = new XSSimpleTypeDecl(null, URI_SCHEMAFORSCHEMA, (short)0, nmtokenDV, true, null);
368         XSSimpleTypeDecl nmtokensDV = new XSSimpleTypeDecl(tempDV, NMTOKENS, URI_SCHEMAFORSCHEMA, (short)0, false, null);
369         nmtokensDV.applyFacets1(facets, XSSimpleType.FACET_MINLENGTH, (short)0);
370         fBuiltInTypes.put(NMTOKENS, nmtokensDV);
371     }//createBuiltInTypes()
372

373     public void setDeclPool (XSDeclarationPool declPool){
374         fDeclPool = declPool;
375     }
376
377 }//SchemaDVFactoryImpl
378
Popular Tags