1 /*
2  * reserved comment block
3  * DO NOT REMOVE OR ALTER!
4  */
5 /*
6  * Licensed to the Apache Software Foundation (ASF) under one or more
7  * contributor license agreements.  See the NOTICE file distributed with
8  * this work for additional information regarding copyright ownership.
9  * The ASF licenses this file to You under the Apache License, Version 2.0
10  * (the "License"); you may not use this file except in compliance with
11  * the License.  You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 
22 package com.sun.org.apache.xerces.internal.impl.dv.xs;
23 
24 import com.sun.org.apache.xerces.internal.impl.dv.SchemaDVFactory;
25 import com.sun.org.apache.xerces.internal.impl.dv.XSFacets;
26 import com.sun.org.apache.xerces.internal.impl.dv.XSSimpleType;
27 import com.sun.org.apache.xerces.internal.impl.xs.XSDeclarationPool;
28 import com.sun.org.apache.xerces.internal.util.SymbolHash;
29 import com.sun.org.apache.xerces.internal.xs.XSConstants;
30 import com.sun.org.apache.xerces.internal.xs.XSObjectList;
31 
32 /**
33  * the base factory to create/return built-in schema DVs and create user-defined DVs
34  *
35  * @xerces.internal
36  *
37  * @author Neeraj Bajaj, Sun Microsystems, inc.
38  * @author Sandy Gao, IBM
39  * @author Khaled Noaman, IBM
40  *
41  */
42 public abstract class BaseSchemaDVFactory extends SchemaDVFactory {
43 
44     static final String URI_SCHEMAFORSCHEMA = "http://www.w3.org/2001/XMLSchema";
45 
46     protected XSDeclarationPool fDeclPool = null;
47 
48     // create common built-in types
createBuiltInTypes(SymbolHash builtInTypes, XSSimpleTypeDecl baseAtomicType)49     protected static void createBuiltInTypes(SymbolHash builtInTypes, XSSimpleTypeDecl baseAtomicType) {
50         // all schema simple type names
51         final String ANYSIMPLETYPE     = "anySimpleType";
52         final String ANYURI            = "anyURI";
53         final String BASE64BINARY      = "base64Binary";
54         final String BOOLEAN           = "boolean";
55         final String BYTE              = "byte";
56         final String DATE              = "date";
57         final String DATETIME          = "dateTime";
58         final String DAY               = "gDay";
59         final String DECIMAL           = "decimal";
60         final String DOUBLE            = "double";
61         final String DURATION          = "duration";
62         final String ENTITY            = "ENTITY";
63         final String ENTITIES          = "ENTITIES";
64         final String FLOAT             = "float";
65         final String HEXBINARY         = "hexBinary";
66         final String ID                = "ID";
67         final String IDREF             = "IDREF";
68         final String IDREFS            = "IDREFS";
69         final String INT               = "int";
70         final String INTEGER           = "integer";
71         final String LONG              = "long";
72         final String NAME              = "Name";
73         final String NEGATIVEINTEGER   = "negativeInteger";
74         final String MONTH             = "gMonth";
75         final String MONTHDAY          = "gMonthDay";
76         final String NCNAME            = "NCName";
77         final String NMTOKEN           = "NMTOKEN";
78         final String NMTOKENS          = "NMTOKENS";
79         final String LANGUAGE          = "language";
80         final String NONNEGATIVEINTEGER= "nonNegativeInteger";
81         final String NONPOSITIVEINTEGER= "nonPositiveInteger";
82         final String NORMALIZEDSTRING  = "normalizedString";
83         final String NOTATION          = "NOTATION";
84         final String POSITIVEINTEGER   = "positiveInteger";
85         final String QNAME             = "QName";
86         final String SHORT             = "short";
87         final String STRING            = "string";
88         final String TIME              = "time";
89         final String TOKEN             = "token";
90         final String UNSIGNEDBYTE      = "unsignedByte";
91         final String UNSIGNEDINT       = "unsignedInt";
92         final String UNSIGNEDLONG      = "unsignedLong";
93         final String UNSIGNEDSHORT     = "unsignedShort";
94         final String YEAR              = "gYear";
95         final String YEARMONTH         = "gYearMonth";
96 
97         final XSFacets facets = new XSFacets();
98 
99         builtInTypes.put(ANYSIMPLETYPE, XSSimpleTypeDecl.fAnySimpleType);
100 
101         XSSimpleTypeDecl stringDV = new XSSimpleTypeDecl(baseAtomicType, STRING, XSSimpleTypeDecl.DV_STRING, XSSimpleType.ORDERED_FALSE, false, false, false , true, XSConstants.STRING_DT);
102         builtInTypes.put(STRING, stringDV);
103         builtInTypes.put(BOOLEAN, new XSSimpleTypeDecl(baseAtomicType, BOOLEAN, XSSimpleTypeDecl.DV_BOOLEAN, XSSimpleType.ORDERED_FALSE, false, true, false, true, XSConstants.BOOLEAN_DT));
104         XSSimpleTypeDecl decimalDV = new XSSimpleTypeDecl(baseAtomicType, DECIMAL, XSSimpleTypeDecl.DV_DECIMAL, XSSimpleType.ORDERED_TOTAL, false, false, true, true, XSConstants.DECIMAL_DT);
105         builtInTypes.put(DECIMAL, decimalDV);
106 
107         builtInTypes.put(ANYURI, new XSSimpleTypeDecl(baseAtomicType, ANYURI, XSSimpleTypeDecl.DV_ANYURI, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.ANYURI_DT));
108         builtInTypes.put(BASE64BINARY, new XSSimpleTypeDecl(baseAtomicType, BASE64BINARY, XSSimpleTypeDecl.DV_BASE64BINARY, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.BASE64BINARY_DT));
109 
110         XSSimpleTypeDecl durationDV = new XSSimpleTypeDecl(baseAtomicType, DURATION, XSSimpleTypeDecl.DV_DURATION, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.DURATION_DT);
111         builtInTypes.put(DURATION, durationDV);
112 
113         builtInTypes.put(DATETIME, new XSSimpleTypeDecl(baseAtomicType, DATETIME, XSSimpleTypeDecl.DV_DATETIME, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.DATETIME_DT));
114         builtInTypes.put(TIME, new XSSimpleTypeDecl(baseAtomicType, TIME, XSSimpleTypeDecl.DV_TIME, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.TIME_DT));
115         builtInTypes.put(DATE, new XSSimpleTypeDecl(baseAtomicType, DATE, XSSimpleTypeDecl.DV_DATE, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.DATE_DT));
116         builtInTypes.put(YEARMONTH, new XSSimpleTypeDecl(baseAtomicType, YEARMONTH, XSSimpleTypeDecl.DV_GYEARMONTH, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.GYEARMONTH_DT));
117         builtInTypes.put(YEAR, new XSSimpleTypeDecl(baseAtomicType, YEAR, XSSimpleTypeDecl.DV_GYEAR, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.GYEAR_DT));
118         builtInTypes.put(MONTHDAY, new XSSimpleTypeDecl(baseAtomicType, MONTHDAY, XSSimpleTypeDecl.DV_GMONTHDAY, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.GMONTHDAY_DT));
119         builtInTypes.put(DAY, new XSSimpleTypeDecl(baseAtomicType, DAY, XSSimpleTypeDecl.DV_GDAY, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.GDAY_DT));
120         builtInTypes.put(MONTH, new XSSimpleTypeDecl(baseAtomicType, MONTH, XSSimpleTypeDecl.DV_GMONTH, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSConstants.GMONTH_DT));
121 
122         XSSimpleTypeDecl integerDV = new XSSimpleTypeDecl(decimalDV, INTEGER, XSSimpleTypeDecl.DV_INTEGER, XSSimpleType.ORDERED_TOTAL, false, false, true, true, XSConstants.INTEGER_DT);
123         builtInTypes.put(INTEGER, integerDV);
124 
125         facets.maxInclusive = "0";
126         XSSimpleTypeDecl nonPositiveDV = new XSSimpleTypeDecl(integerDV, NONPOSITIVEINTEGER, URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NONPOSITIVEINTEGER_DT);
127         nonPositiveDV.applyFacets1(facets , XSSimpleType.FACET_MAXINCLUSIVE, (short)0);
128         builtInTypes.put(NONPOSITIVEINTEGER, nonPositiveDV);
129 
130         facets.maxInclusive = "-1";
131         XSSimpleTypeDecl negativeDV = new XSSimpleTypeDecl(nonPositiveDV, NEGATIVEINTEGER, URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NEGATIVEINTEGER_DT);
132         negativeDV.applyFacets1(facets , XSSimpleType.FACET_MAXINCLUSIVE, (short)0);
133         builtInTypes.put(NEGATIVEINTEGER, negativeDV);
134 
135         facets.maxInclusive = "9223372036854775807";
136         facets.minInclusive = "-9223372036854775808";
137         XSSimpleTypeDecl longDV = new XSSimpleTypeDecl(integerDV, LONG, URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.LONG_DT);
138         longDV.applyFacets1(facets , (short)(XSSimpleType.FACET_MAXINCLUSIVE | XSSimpleType.FACET_MININCLUSIVE), (short)0 );
139         builtInTypes.put(LONG, longDV);
140 
141         facets.maxInclusive = "2147483647";
142         facets.minInclusive =  "-2147483648";
143         XSSimpleTypeDecl intDV = new XSSimpleTypeDecl(longDV, INT, URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.INT_DT);
144         intDV.applyFacets1(facets, (short)(XSSimpleType.FACET_MAXINCLUSIVE | XSSimpleType.FACET_MININCLUSIVE), (short)0 );
145         builtInTypes.put(INT, intDV);
146 
147         facets.maxInclusive = "32767";
148         facets.minInclusive = "-32768";
149         XSSimpleTypeDecl shortDV = new XSSimpleTypeDecl(intDV, SHORT , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.SHORT_DT);
150         shortDV.applyFacets1(facets, (short)(XSSimpleType.FACET_MAXINCLUSIVE | XSSimpleType.FACET_MININCLUSIVE), (short)0 );
151         builtInTypes.put(SHORT, shortDV);
152 
153         facets.maxInclusive = "127";
154         facets.minInclusive = "-128";
155         XSSimpleTypeDecl byteDV = new XSSimpleTypeDecl(shortDV, BYTE , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.BYTE_DT);
156         byteDV.applyFacets1(facets, (short)(XSSimpleType.FACET_MAXINCLUSIVE | XSSimpleType.FACET_MININCLUSIVE), (short)0 );
157         builtInTypes.put(BYTE, byteDV);
158 
159         facets.minInclusive =  "0" ;
160         XSSimpleTypeDecl nonNegativeDV = new XSSimpleTypeDecl(integerDV, NONNEGATIVEINTEGER , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NONNEGATIVEINTEGER_DT);
161         nonNegativeDV.applyFacets1(facets, XSSimpleType.FACET_MININCLUSIVE, (short)0 );
162         builtInTypes.put(NONNEGATIVEINTEGER, nonNegativeDV);
163 
164         facets.maxInclusive = "18446744073709551615" ;
165         XSSimpleTypeDecl unsignedLongDV = new XSSimpleTypeDecl(nonNegativeDV, UNSIGNEDLONG , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.UNSIGNEDLONG_DT);
166         unsignedLongDV.applyFacets1(facets, XSSimpleType.FACET_MAXINCLUSIVE, (short)0 );
167         builtInTypes.put(UNSIGNEDLONG, unsignedLongDV);
168 
169         facets.maxInclusive = "4294967295" ;
170         XSSimpleTypeDecl unsignedIntDV = new XSSimpleTypeDecl(unsignedLongDV, UNSIGNEDINT , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.UNSIGNEDINT_DT);
171         unsignedIntDV.applyFacets1(facets, XSSimpleType.FACET_MAXINCLUSIVE, (short)0 );
172         builtInTypes.put(UNSIGNEDINT, unsignedIntDV);
173 
174         facets.maxInclusive = "65535" ;
175         XSSimpleTypeDecl unsignedShortDV = new XSSimpleTypeDecl(unsignedIntDV, UNSIGNEDSHORT , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.UNSIGNEDSHORT_DT);
176         unsignedShortDV.applyFacets1(facets, XSSimpleType.FACET_MAXINCLUSIVE, (short)0 );
177         builtInTypes.put(UNSIGNEDSHORT, unsignedShortDV);
178 
179         facets.maxInclusive = "255" ;
180         XSSimpleTypeDecl unsignedByteDV = new XSSimpleTypeDecl(unsignedShortDV, UNSIGNEDBYTE , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.UNSIGNEDBYTE_DT);
181         unsignedByteDV.applyFacets1(facets, XSSimpleType.FACET_MAXINCLUSIVE, (short)0 );
182         builtInTypes.put(UNSIGNEDBYTE, unsignedByteDV);
183 
184         facets.minInclusive = "1" ;
185         XSSimpleTypeDecl positiveIntegerDV = new XSSimpleTypeDecl(nonNegativeDV, POSITIVEINTEGER , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.POSITIVEINTEGER_DT);
186         positiveIntegerDV.applyFacets1(facets, XSSimpleType.FACET_MININCLUSIVE, (short)0 );
187         builtInTypes.put(POSITIVEINTEGER, positiveIntegerDV);
188 
189         builtInTypes.put(FLOAT, new XSSimpleTypeDecl(baseAtomicType, FLOAT, XSSimpleTypeDecl.DV_FLOAT, XSSimpleType.ORDERED_PARTIAL, true, true, true, true, XSConstants.FLOAT_DT));
190         builtInTypes.put(DOUBLE, new XSSimpleTypeDecl(baseAtomicType, DOUBLE, XSSimpleTypeDecl.DV_DOUBLE, XSSimpleType.ORDERED_PARTIAL, true, true, true, true, XSConstants.DOUBLE_DT));
191         builtInTypes.put(HEXBINARY, new XSSimpleTypeDecl(baseAtomicType, HEXBINARY, XSSimpleTypeDecl.DV_HEXBINARY, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.HEXBINARY_DT));
192         builtInTypes.put(NOTATION, new XSSimpleTypeDecl(baseAtomicType, NOTATION, XSSimpleTypeDecl.DV_NOTATION, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.NOTATION_DT));
193 
194         facets.whiteSpace =  XSSimpleType.WS_REPLACE;
195         XSSimpleTypeDecl normalizedDV = new XSSimpleTypeDecl(stringDV, NORMALIZEDSTRING , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NORMALIZEDSTRING_DT);
196         normalizedDV.applyFacets1(facets, XSSimpleType.FACET_WHITESPACE, (short)0 );
197         builtInTypes.put(NORMALIZEDSTRING, normalizedDV);
198 
199         facets.whiteSpace = XSSimpleType.WS_COLLAPSE;
200         XSSimpleTypeDecl tokenDV = new XSSimpleTypeDecl(normalizedDV, TOKEN , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.TOKEN_DT);
201         tokenDV.applyFacets1(facets, XSSimpleType.FACET_WHITESPACE, (short)0 );
202         builtInTypes.put(TOKEN, tokenDV);
203 
204         facets.whiteSpace = XSSimpleType.WS_COLLAPSE;
205         facets.pattern  = "([a-zA-Z]{1,8})(-[a-zA-Z0-9]{1,8})*";
206         XSSimpleTypeDecl languageDV = new XSSimpleTypeDecl(tokenDV, LANGUAGE , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.LANGUAGE_DT);
207         languageDV.applyFacets1(facets, (short)(XSSimpleType.FACET_WHITESPACE | XSSimpleType.FACET_PATTERN) ,(short)0);
208         builtInTypes.put(LANGUAGE, languageDV);
209 
210         facets.whiteSpace =  XSSimpleType.WS_COLLAPSE;
211         XSSimpleTypeDecl nameDV = new XSSimpleTypeDecl(tokenDV, NAME , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NAME_DT);
212         nameDV.applyFacets1(facets, XSSimpleType.FACET_WHITESPACE, (short)0, XSSimpleTypeDecl.SPECIAL_PATTERN_NAME);
213         builtInTypes.put(NAME, nameDV);
214 
215         facets.whiteSpace = XSSimpleType.WS_COLLAPSE;
216         XSSimpleTypeDecl ncnameDV = new XSSimpleTypeDecl(nameDV, NCNAME , URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NCNAME_DT) ;
217         ncnameDV.applyFacets1(facets, XSSimpleType.FACET_WHITESPACE, (short)0, XSSimpleTypeDecl.SPECIAL_PATTERN_NCNAME);
218         builtInTypes.put(NCNAME, ncnameDV);
219 
220         builtInTypes.put(QNAME, new XSSimpleTypeDecl(baseAtomicType, QNAME, XSSimpleTypeDecl.DV_QNAME, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.QNAME_DT));
221 
222         builtInTypes.put(ID, new XSSimpleTypeDecl(ncnameDV,  ID, XSSimpleTypeDecl.DV_ID, XSSimpleType.ORDERED_FALSE, false, false, false , true, XSConstants.ID_DT));
223         XSSimpleTypeDecl idrefDV = new XSSimpleTypeDecl(ncnameDV,  IDREF , XSSimpleTypeDecl.DV_IDREF, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.IDREF_DT);
224         builtInTypes.put(IDREF, idrefDV);
225 
226         facets.minLength = 1;
227         XSSimpleTypeDecl tempDV = new XSSimpleTypeDecl(null, URI_SCHEMAFORSCHEMA, (short)0, idrefDV, true, null);
228         XSSimpleTypeDecl idrefsDV = new XSSimpleTypeDecl(tempDV, IDREFS, URI_SCHEMAFORSCHEMA, (short)0, false, null);
229         idrefsDV.applyFacets1(facets, XSSimpleType.FACET_MINLENGTH, (short)0);
230         builtInTypes.put(IDREFS, idrefsDV);
231 
232         XSSimpleTypeDecl entityDV = new XSSimpleTypeDecl(ncnameDV, ENTITY , XSSimpleTypeDecl.DV_ENTITY, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.ENTITY_DT);
233         builtInTypes.put(ENTITY, entityDV);
234 
235         facets.minLength = 1;
236         tempDV = new XSSimpleTypeDecl(null, URI_SCHEMAFORSCHEMA, (short)0, entityDV, true, null);
237         XSSimpleTypeDecl entitiesDV = new XSSimpleTypeDecl(tempDV, ENTITIES, URI_SCHEMAFORSCHEMA, (short)0, false, null);
238         entitiesDV.applyFacets1(facets, XSSimpleType.FACET_MINLENGTH, (short)0);
239         builtInTypes.put(ENTITIES, entitiesDV);
240 
241         facets.whiteSpace  = XSSimpleType.WS_COLLAPSE;
242         XSSimpleTypeDecl nmtokenDV = new XSSimpleTypeDecl(tokenDV, NMTOKEN, URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NMTOKEN_DT);
243         nmtokenDV.applyFacets1(facets, XSSimpleType.FACET_WHITESPACE, (short)0, XSSimpleTypeDecl.SPECIAL_PATTERN_NMTOKEN);
244         builtInTypes.put(NMTOKEN, nmtokenDV);
245 
246         facets.minLength = 1;
247         tempDV = new XSSimpleTypeDecl(null, URI_SCHEMAFORSCHEMA, (short)0, nmtokenDV, true, null);
248         XSSimpleTypeDecl nmtokensDV = new XSSimpleTypeDecl(tempDV, NMTOKENS, URI_SCHEMAFORSCHEMA, (short)0, false, null);
249         nmtokensDV.applyFacets1(facets, XSSimpleType.FACET_MINLENGTH, (short)0);
250         builtInTypes.put(NMTOKENS, nmtokensDV);
251     } //createBuiltInTypes()
252 
253     /**
254      * Create a new simple type which is derived by restriction from another
255      * simple type.
256      *
257      * @param name              name of the new type, could be null
258      * @param targetNamespace   target namespace of the new type, could be null
259      * @param finalSet          value of "final"
260      * @param base              base type of the new type
261      * @param annotations       set of annotations
262      * @return                  the newly created simple type
263      */
createTypeRestriction(String name, String targetNamespace, short finalSet, XSSimpleType base, XSObjectList annotations)264     public XSSimpleType createTypeRestriction(String name, String targetNamespace,
265                                               short finalSet, XSSimpleType base, XSObjectList annotations) {
266 
267         if (fDeclPool != null) {
268            XSSimpleTypeDecl st= fDeclPool.getSimpleTypeDecl();
269            return st.setRestrictionValues((XSSimpleTypeDecl)base, name, targetNamespace, finalSet, annotations);
270         }
271         return new XSSimpleTypeDecl((XSSimpleTypeDecl)base, name, targetNamespace, finalSet, false, annotations);
272     }
273 
274     /**
275      * Create a new simple type which is derived by list from another simple
276      * type.
277      *
278      * @param name              name of the new type, could be null
279      * @param targetNamespace   target namespace of the new type, could be null
280      * @param finalSet          value of "final"
281      * @param itemType          item type of the list type
282      * @param annotations       set of annotations
283      * @return                  the newly created simple type
284      */
createTypeList(String name, String targetNamespace, short finalSet, XSSimpleType itemType, XSObjectList annotations)285     public XSSimpleType createTypeList(String name, String targetNamespace,
286                                        short finalSet, XSSimpleType itemType,
287                                        XSObjectList annotations) {
288         if (fDeclPool != null) {
289            XSSimpleTypeDecl st= fDeclPool.getSimpleTypeDecl();
290            return st.setListValues(name, targetNamespace, finalSet, (XSSimpleTypeDecl)itemType, annotations);
291         }
292         return new XSSimpleTypeDecl(name, targetNamespace, finalSet, (XSSimpleTypeDecl)itemType, false, annotations);
293     }
294 
295     /**
296      * Create a new simple type which is derived by union from a list of other
297      * simple types.
298      *
299      * @param name              name of the new type, could be null
300      * @param targetNamespace   target namespace of the new type, could be null
301      * @param finalSet          value of "final"
302      * @param memberTypes       member types of the union type
303      * @param annotations       set of annotations
304      * @return                  the newly created simple type
305      */
createTypeUnion(String name, String targetNamespace, short finalSet, XSSimpleType[] memberTypes, XSObjectList annotations)306     public XSSimpleType createTypeUnion(String name, String targetNamespace,
307                                         short finalSet, XSSimpleType[] memberTypes,
308                                         XSObjectList annotations) {
309         int typeNum = memberTypes.length;
310         XSSimpleTypeDecl[] mtypes = new XSSimpleTypeDecl[typeNum];
311         System.arraycopy(memberTypes, 0, mtypes, 0, typeNum);
312 
313         if (fDeclPool != null) {
314            XSSimpleTypeDecl st= fDeclPool.getSimpleTypeDecl();
315            return st.setUnionValues(name, targetNamespace, finalSet, mtypes, annotations);
316         }
317         return new XSSimpleTypeDecl(name, targetNamespace, finalSet, mtypes, annotations);
318     }
319 
setDeclPool(XSDeclarationPool declPool)320     public void setDeclPool (XSDeclarationPool declPool){
321         fDeclPool = declPool;
322     }
323 
324     /** Implementation internal **/
newXSSimpleTypeDecl()325     public XSSimpleTypeDecl newXSSimpleTypeDecl() {
326         return new XSSimpleTypeDecl();
327     }
328 } //BaseSchemaDVFactory
329