KickJava   Java API By Example, From Geeks To Geeks.

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


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
58 package com.sun.org.apache.xerces.internal.impl.dv.xs;
59
60 import com.sun.org.apache.xerces.internal.impl.dv.SchemaDVFactory;
61 import com.sun.org.apache.xerces.internal.impl.dv.XSSimpleType;
62 import com.sun.org.apache.xerces.internal.impl.dv.XSFacets;
63 import com.sun.org.apache.xerces.internal.impl.xs.XSDeclarationPool;
64 import com.sun.org.apache.xerces.internal.xs.XSConstants;
65 import com.sun.org.apache.xerces.internal.xs.XSObjectList;
66 import com.sun.org.apache.xerces.internal.util.SymbolHash;
67
68 /**
69  * the factory to create/return built-in schema DVs and create user-defined DVs
70  *
71  * @author Neeraj Bajaj, Sun Microsystems, inc.
72  * @author Sandy Gao, IBM
73  *
74  * @version $Id: SchemaDVFactoryImpl.java,v 1.14 2003/11/12 23:17:32 sandygao Exp $
75  */

76 public class SchemaDVFactoryImpl extends SchemaDVFactory {
77
78     static final String JavaDoc URI_SCHEMAFORSCHEMA = "http://www.w3.org/2001/XMLSchema";
79
80     static SymbolHash fBuiltInTypes = new SymbolHash();
81     static {
82         createBuiltInTypes();
83     }
84
85     protected XSDeclarationPool fDeclPool = null;
86
87     /**
88      * Get a built-in simple type of the given name
89      * REVISIT: its still not decided within the Schema WG how to define the
90      * ur-types and if all simple types should be derived from a
91      * complex type, so as of now we ignore the fact that anySimpleType
92      * is derived from anyType, and pass 'null' as the base of
93      * anySimpleType. It needs to be changed as per the decision taken.
94      *
95      * @param name the name of the datatype
96      * @return the datatype validator of the given name
97      */

98     public XSSimpleType getBuiltInType(String JavaDoc name) {
99         return (XSSimpleType)fBuiltInTypes.get(name);
100     }
101
102     /**
103      * get all built-in simple types, which are stored in a hashtable keyed by
104      * the name
105      *
106      * @return a hashtable which contains all built-in simple types
107      */

108     public SymbolHash getBuiltInTypes() {
109         return (SymbolHash)fBuiltInTypes.makeClone();
110     }
111
112     /**
113      * Create a new simple type which is derived by restriction from another
114      * simple type.
115      *
116      * @param name name of the new type, could be null
117      * @param targetNamespace target namespace of the new type, could be null
118      * @param finalSet value of "final"
119      * @param base base type of the new type
120      * @param annotations set of annotations
121      * @return the newly created simple type
122      */

123     public XSSimpleType createTypeRestriction(String JavaDoc name, String JavaDoc targetNamespace,
124                                               short finalSet, XSSimpleType base, XSObjectList annotations) {
125         
126         if (fDeclPool != null) {
127            XSSimpleTypeDecl st= fDeclPool.getSimpleTypeDecl();
128            return st.setRestrictionValues((XSSimpleTypeDecl)base, name, targetNamespace, finalSet, annotations);
129         }
130         return new XSSimpleTypeDecl((XSSimpleTypeDecl)base, name, targetNamespace, finalSet, false, annotations);
131     }
132
133     /**
134      * Create a new simple type which is derived by list from another simple
135      * type.
136      *
137      * @param name name of the new type, could be null
138      * @param targetNamespace target namespace of the new type, could be null
139      * @param finalSet value of "final"
140      * @param itemType item type of the list type
141      * @param annotations set of annotations
142      * @return the newly created simple type
143      */

144     public XSSimpleType createTypeList(String JavaDoc name, String JavaDoc targetNamespace,
145                                        short finalSet, XSSimpleType itemType,
146                                        XSObjectList annotations) {
147         if (fDeclPool != null) {
148            XSSimpleTypeDecl st= fDeclPool.getSimpleTypeDecl();
149            return st.setListValues(name, targetNamespace, finalSet, (XSSimpleTypeDecl)itemType, annotations);
150         }
151         return new XSSimpleTypeDecl(name, targetNamespace, finalSet, (XSSimpleTypeDecl)itemType, false, annotations);
152     }
153
154     /**
155      * Create a new simple type which is derived by union from a list of other
156      * simple types.
157      *
158      * @param name name of the new type, could be null
159      * @param targetNamespace target namespace of the new type, could be null
160      * @param finalSet value of "final"
161      * @param base member types of the union type
162      * @param annotations set of annotations
163      * @return the newly created simple type
164      */

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

387     public void setDeclPool (XSDeclarationPool declPool){
388         fDeclPool = declPool;
389     }
390
391 }//SchemaDVFactoryImpl
392
Popular Tags