View Javadoc
1   /*
2    * reserved comment block
3    * DO NOT REMOVE OR ALTER!
4    */
5   /*
6    * Copyright 2001-2005 The Apache Software Foundation.
7    *
8    * Licensed under the Apache License, Version 2.0 (the "License");
9    * you may not use this file except in compliance with the License.
10   * You may obtain a copy of the License at
11   *
12   *      http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  
21  package com.sun.org.apache.xerces.internal.impl.xs.traversers;
22  
23  import java.util.ArrayList;
24  import java.util.Vector;
25  
26  import com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeFacetException;
27  import com.sun.org.apache.xerces.internal.impl.dv.SchemaDVFactory;
28  import com.sun.org.apache.xerces.internal.impl.dv.XSSimpleType;
29  import com.sun.org.apache.xerces.internal.impl.dv.xs.SchemaDVFactoryImpl;
30  import com.sun.org.apache.xerces.internal.impl.dv.xs.XSSimpleTypeDecl;
31  import com.sun.org.apache.xerces.internal.impl.xs.SchemaGrammar;
32  import com.sun.org.apache.xerces.internal.impl.xs.SchemaSymbols;
33  import com.sun.org.apache.xerces.internal.impl.xs.XSAnnotationImpl;
34  import com.sun.org.apache.xerces.internal.impl.xs.util.XInt;
35  import com.sun.org.apache.xerces.internal.impl.xs.util.XSObjectListImpl;
36  import com.sun.org.apache.xerces.internal.util.DOMUtil;
37  import com.sun.org.apache.xerces.internal.xni.QName;
38  import com.sun.org.apache.xerces.internal.xs.XSConstants;
39  import com.sun.org.apache.xerces.internal.xs.XSObjectList;
40  import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition;
41  import org.w3c.dom.Element;
42  
43  /**
44   * The simple type definition schema component traverser.
45   *
46   * <simpleType
47   *   final = (#all | (list | union | restriction))
48   *   id = ID
49   *   name = NCName
50   *   {any attributes with non-schema namespace . . .}>
51   *   Content: (annotation?, (restriction | list | union))
52   * </simpleType>
53   *
54   * <restriction
55   *   base = QName
56   *   id = ID
57   *   {any attributes with non-schema namespace . . .}>
58   *   Content: (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*))
59   * </restriction>
60   *
61   * <list
62   *   id = ID
63   *   itemType = QName
64   *   {any attributes with non-schema namespace . . .}>
65   *   Content: (annotation?, (simpleType?))
66   * </list>
67   *
68   * <union
69   *   id = ID
70   *   memberTypes = List of QName
71   *   {any attributes with non-schema namespace . . .}>
72   *   Content: (annotation?, (simpleType*))
73   * </union>
74   *
75   * @xerces.internal
76   *
77   * @author Elena Litani, IBM
78   * @author Neeraj Bajaj, Sun Microsystems, Inc.
79   * @author Sandy Gao, IBM
80   *
81   * @version $Id: XSDSimpleTypeTraverser.java,v 1.7 2010-11-01 04:40:02 joehw Exp $
82   */
83  class XSDSimpleTypeTraverser extends XSDAbstractTraverser {
84  
85      // whether the type being parsed is a S4S built-in type.
86      private boolean fIsBuiltIn = false;
87  
88      XSDSimpleTypeTraverser (XSDHandler handler,
89              XSAttributeChecker gAttrCheck) {
90          super(handler, gAttrCheck);
91      }
92  
93      //return qualified name of simpleType or empty string if error occured
94      XSSimpleType traverseGlobal(Element elmNode,
95              XSDocumentInfo schemaDoc,
96              SchemaGrammar grammar) {
97  
98          // General Attribute Checking
99          Object[] attrValues = fAttrChecker.checkAttributes(elmNode, true, schemaDoc);
100         String nameAtt = (String)attrValues[XSAttributeChecker.ATTIDX_NAME];
101         if (nameAtt == null) {
102             attrValues[XSAttributeChecker.ATTIDX_NAME] = NO_NAME;
103         }
104         XSSimpleType type = traverseSimpleTypeDecl(elmNode, attrValues, schemaDoc, grammar);
105         fAttrChecker.returnAttrArray(attrValues, schemaDoc);
106 
107         // if it's a global type without a name, return null
108         if (nameAtt == null) {
109             reportSchemaError("s4s-att-must-appear", new Object[]{SchemaSymbols.ELT_SIMPLETYPE, SchemaSymbols.ATT_NAME}, elmNode);
110             type = null;
111         }
112 
113         // don't add global components without name to the grammar
114         if (type != null) {
115             if (grammar.getGlobalTypeDecl(type.getName()) == null) {
116                 grammar.addGlobalSimpleTypeDecl(type);
117             }
118 
119             // also add it to extended map
120             final String loc = fSchemaHandler.schemaDocument2SystemId(schemaDoc);
121             final XSTypeDefinition type2 = grammar.getGlobalTypeDecl(type.getName(), loc);
122             if (type2 == null) {
123                 grammar.addGlobalSimpleTypeDecl(type, loc);
124             }
125 
126             // handle duplicates
127             if (fSchemaHandler.fTolerateDuplicates) {
128                 if (type2 != null) {
129                     if (type2 instanceof XSSimpleType) {
130                         type = (XSSimpleType) type2;
131                     }
132                 }
133                 fSchemaHandler.addGlobalTypeDecl(type);
134             }
135         }
136 
137         return type;
138     }
139 
140     XSSimpleType traverseLocal(Element elmNode,
141             XSDocumentInfo schemaDoc,
142             SchemaGrammar grammar) {
143 
144         // General Attribute Checking
145         Object[] attrValues = fAttrChecker.checkAttributes(elmNode, false, schemaDoc);
146         String name = genAnonTypeName(elmNode);
147         XSSimpleType type = getSimpleType (name, elmNode, attrValues, schemaDoc, grammar);
148         if (type instanceof XSSimpleTypeDecl) {
149             ((XSSimpleTypeDecl)type).setAnonymous(true);
150         }
151         fAttrChecker.returnAttrArray(attrValues, schemaDoc);
152 
153         return type;
154     }
155 
156     private XSSimpleType traverseSimpleTypeDecl(Element simpleTypeDecl,
157             Object[] attrValues,
158             XSDocumentInfo schemaDoc,
159             SchemaGrammar grammar) {
160 
161         // get name and final values
162         String name = (String)attrValues[XSAttributeChecker.ATTIDX_NAME];
163         return getSimpleType(name, simpleTypeDecl, attrValues, schemaDoc, grammar);
164     }
165 
166     /*
167      * Generate a name for an anonymous type
168      */
169     private String genAnonTypeName(Element simpleTypeDecl) {
170 
171         // Generate a unique name for the anonymous type by concatenating together the
172         // names of parent nodes
173         // The name is quite good for debugging/error purposes, but we may want to
174         // revisit how this is done for performance reasons (LM).
175         StringBuffer typeName = new StringBuffer("#AnonType_");
176         Element node = DOMUtil.getParent(simpleTypeDecl);
177         while (node != null && (node != DOMUtil.getRoot(DOMUtil.getDocument(node)))) {
178             typeName.append(node.getAttribute(SchemaSymbols.ATT_NAME));
179             node = DOMUtil.getParent(node);
180         }
181         return typeName.toString();
182     }
183 
184     /**
185      * @param name
186      * @param simpleTypeDecl
187      * @param attrValues
188      * @param schemaDoc
189      * @param grammar
190      * @return
191      */
192     private XSSimpleType getSimpleType(String name, Element simpleTypeDecl, Object[] attrValues, XSDocumentInfo schemaDoc, SchemaGrammar grammar) {
193         XInt finalAttr = (XInt)attrValues[XSAttributeChecker.ATTIDX_FINAL];
194         int finalProperty = finalAttr == null ? schemaDoc.fFinalDefault : finalAttr.intValue();
195         // annotation?,(list|restriction|union)
196         Element child = DOMUtil.getFirstChildElement(simpleTypeDecl);
197         XSAnnotationImpl [] annotations = null;
198         if (child != null && DOMUtil.getLocalName(child).equals(SchemaSymbols.ELT_ANNOTATION)) {
199             XSAnnotationImpl annotation = traverseAnnotationDecl(child, attrValues, false, schemaDoc);
200             if (annotation != null)
201                 annotations = new XSAnnotationImpl [] {annotation};
202             child = DOMUtil.getNextSiblingElement(child);
203         }
204         else {
205             String text = DOMUtil.getSyntheticAnnotation(simpleTypeDecl);
206             if (text != null) {
207                 XSAnnotationImpl annotation = traverseSyntheticAnnotation(simpleTypeDecl, text, attrValues, false, schemaDoc);
208                 annotations = new XSAnnotationImpl[] {annotation};
209             }
210         }
211         // (list|restriction|union)
212         if (child == null) {
213             reportSchemaError("s4s-elt-must-match.2", new Object[]{SchemaSymbols.ELT_SIMPLETYPE, "(annotation?, (restriction | list | union))"}, simpleTypeDecl);
214             return errorType(name, schemaDoc.fTargetNamespace, XSConstants.DERIVATION_RESTRICTION);
215         }
216         // derivation type: restriction/list/union
217         String varietyProperty = DOMUtil.getLocalName(child);
218         short refType = XSConstants.DERIVATION_RESTRICTION;
219         boolean restriction = false, list = false, union = false;
220         if (varietyProperty.equals(SchemaSymbols.ELT_RESTRICTION)) {
221             refType = XSConstants.DERIVATION_RESTRICTION;
222             restriction = true;
223         }
224         else if (varietyProperty.equals(SchemaSymbols.ELT_LIST)) {
225             refType = XSConstants.DERIVATION_LIST;
226             list = true;
227         }
228         else if (varietyProperty.equals(SchemaSymbols.ELT_UNION)) {
229             refType = XSConstants.DERIVATION_UNION;
230             union = true;
231         }
232         else {
233             reportSchemaError("s4s-elt-must-match.1", new Object[]{SchemaSymbols.ELT_SIMPLETYPE, "(annotation?, (restriction | list | union))", varietyProperty}, simpleTypeDecl);
234             return errorType(name, schemaDoc.fTargetNamespace, XSConstants.DERIVATION_RESTRICTION);
235         }
236         // nothing should follow this element
237         Element nextChild = DOMUtil.getNextSiblingElement(child);
238         if (nextChild != null) {
239             reportSchemaError("s4s-elt-must-match.1", new Object[]{SchemaSymbols.ELT_SIMPLETYPE, "(annotation?, (restriction | list | union))", DOMUtil.getLocalName(nextChild)}, nextChild);
240         }
241         // General Attribute Checking: get base/item/member types
242         Object[] contentAttrs = fAttrChecker.checkAttributes(child, false, schemaDoc);
243         QName baseTypeName = (QName)contentAttrs[restriction ?
244                 XSAttributeChecker.ATTIDX_BASE :
245                     XSAttributeChecker.ATTIDX_ITEMTYPE];
246         Vector memberTypes = (Vector)contentAttrs[XSAttributeChecker.ATTIDX_MEMBERTYPES];
247         //content = {annotation?,simpleType?...}
248         Element content = DOMUtil.getFirstChildElement(child);
249         //check content (annotation?, ...)
250         if (content != null && DOMUtil.getLocalName(content).equals(SchemaSymbols.ELT_ANNOTATION)) {
251             XSAnnotationImpl annotation = traverseAnnotationDecl(content, contentAttrs, false, schemaDoc);
252             if (annotation != null ) {
253                 if(annotations == null) {
254                     annotations = new XSAnnotationImpl [] {annotation};
255                 }
256                 else {
257                     XSAnnotationImpl [] tempArray = new XSAnnotationImpl[2];
258                     tempArray[0] = annotations[0];
259                     annotations = tempArray;
260                     annotations[1] = annotation;
261                 }
262             }
263             content = DOMUtil.getNextSiblingElement(content);
264         }
265         else {
266             String text = DOMUtil.getSyntheticAnnotation(child);
267             if (text != null) {
268                 XSAnnotationImpl annotation = traverseSyntheticAnnotation(child, text, contentAttrs, false, schemaDoc);
269                 if (annotations == null) {
270                     annotations = new XSAnnotationImpl [] {annotation};
271                 }
272                 else {
273                     XSAnnotationImpl [] tempArray = new XSAnnotationImpl[2];
274                     tempArray[0] = annotations[0];
275                     annotations = tempArray;
276                     annotations[1] = annotation;
277                 }
278             }
279         }
280         // get base type from "base" attribute
281         XSSimpleType baseValidator = null;
282         if ((restriction || list) && baseTypeName != null) {
283             baseValidator = findDTValidator(child, name, baseTypeName, refType, schemaDoc);
284             // if its the built-in type, return null from here
285             if (baseValidator == null && fIsBuiltIn) {
286                 fIsBuiltIn = false;
287                 return null;
288             }
289         }
290         // get types from "memberTypes" attribute
291         ArrayList dTValidators = null;
292         XSSimpleType dv = null;
293         XSObjectList dvs;
294         if (union && memberTypes != null && memberTypes.size() > 0) {
295             int size = memberTypes.size();
296             dTValidators = new ArrayList(size);
297             // for each qname in the list
298             for (int i = 0; i < size; i++) {
299                 // get the type decl
300                 dv = findDTValidator(child, name, (QName)memberTypes.elementAt(i),
301                         XSConstants.DERIVATION_UNION, schemaDoc);
302                 if (dv != null) {
303                     // if it's a union, expand it
304                     if (dv.getVariety() == XSSimpleType.VARIETY_UNION) {
305                         dvs = dv.getMemberTypes();
306                         for (int j = 0; j < dvs.getLength(); j++)
307                             dTValidators.add(dvs.item(j));
308                     } else {
309                         dTValidators.add(dv);
310                     }
311                 }
312             }
313         }
314 
315         // check if there is a child "simpleType"
316         if (content != null && DOMUtil.getLocalName(content).equals(SchemaSymbols.ELT_SIMPLETYPE)) {
317             if (restriction || list) {
318                 // it's an error for both "base" and "simpleType" to appear
319                 if (baseTypeName != null) {
320                     reportSchemaError(list ? "src-simple-type.3.a" : "src-simple-type.2.a", null, content);
321                 }
322                 if (baseValidator == null) {
323                     // traverse this child to get the base type
324                     baseValidator = traverseLocal(content, schemaDoc, grammar);
325                 }
326                 // get the next element
327                 content = DOMUtil.getNextSiblingElement(content);
328             }
329             else if (union) {
330                 if (dTValidators == null) {
331                     dTValidators = new ArrayList(2);
332                 }
333                 do {
334                     // traverse this child to get the member type
335                     dv = traverseLocal(content, schemaDoc, grammar);
336                     if (dv != null) {
337                         // if it's a union, expand it
338                         if (dv.getVariety() == XSSimpleType.VARIETY_UNION) {
339                             dvs = dv.getMemberTypes();
340                             for (int j = 0; j < dvs.getLength(); j++) {
341                                 dTValidators.add(dvs.item(j));
342                             }
343                         }
344                         else {
345                             dTValidators.add(dv);
346                         }
347                     }
348                     // get the next element
349                     content = DOMUtil.getNextSiblingElement(content);
350                 } while (content != null && DOMUtil.getLocalName(content).equals(SchemaSymbols.ELT_SIMPLETYPE));
351             }
352         }
353         else if ((restriction || list) && baseTypeName == null) {
354             // it's an error if neither "base/itemType" nor "simpleType" appears
355             reportSchemaError(list ? "src-simple-type.3.b" : "src-simple-type.2.b", null, child);
356         }
357         else if (union && (memberTypes == null || memberTypes.size() == 0)) {
358             // it's an error if "memberTypes" is empty and no "simpleType" appears
359             reportSchemaError("src-union-memberTypes-or-simpleTypes", null, child);
360         }
361         // error finding "base" or error traversing "simpleType".
362         // don't need to report an error, since some error has been reported.
363         if ((restriction || list) && baseValidator == null) {
364             fAttrChecker.returnAttrArray(contentAttrs, schemaDoc);
365             return errorType(name, schemaDoc.fTargetNamespace,
366                     restriction ? XSConstants.DERIVATION_RESTRICTION : XSConstants.DERIVATION_LIST);
367         }
368         // error finding "memberTypes" or error traversing "simpleType".
369         // don't need to report an error, since some error has been reported.
370         if (union && (dTValidators == null || dTValidators.size() == 0)) {
371             fAttrChecker.returnAttrArray(contentAttrs, schemaDoc);
372             return errorType(name, schemaDoc.fTargetNamespace,
373                     XSConstants.DERIVATION_UNION);
374         }
375         // item type of list types can't have list content
376         if (list && isListDatatype(baseValidator)) {
377             reportSchemaError("cos-st-restricts.2.1", new Object[]{name, baseValidator.getName()}, child);
378             fAttrChecker.returnAttrArray(contentAttrs, schemaDoc);
379             return errorType(name, schemaDoc.fTargetNamespace,
380                     XSConstants.DERIVATION_LIST);
381         }
382         // create the simple type based on the "base" type
383         XSSimpleType newDecl = null;
384         if (restriction) {
385             newDecl = fSchemaHandler.fDVFactory.createTypeRestriction(name, schemaDoc.fTargetNamespace, (short)finalProperty, baseValidator,
386                     annotations == null? null : new XSObjectListImpl(annotations, annotations.length));
387         }
388         else if (list) {
389             newDecl = fSchemaHandler.fDVFactory.createTypeList(name, schemaDoc.fTargetNamespace, (short)finalProperty, baseValidator,
390                     annotations == null? null : new XSObjectListImpl(annotations, annotations.length));
391         }
392         else if (union) {
393             XSSimpleType[] memberDecls = (XSSimpleType[]) dTValidators.toArray(new XSSimpleType[dTValidators.size()]);
394             newDecl = fSchemaHandler.fDVFactory.createTypeUnion(name, schemaDoc.fTargetNamespace, (short)finalProperty, memberDecls,
395                     annotations == null? null : new XSObjectListImpl(annotations, annotations.length));
396         }
397         // now traverse facets, if it's derived by restriction
398         if (restriction && content != null) {
399             FacetInfo fi = traverseFacets(content, baseValidator, schemaDoc);
400             content = fi.nodeAfterFacets;
401 
402             try {
403                 fValidationState.setNamespaceSupport(schemaDoc.fNamespaceSupport);
404                 newDecl.applyFacets(fi.facetdata, fi.fPresentFacets, fi.fFixedFacets, fValidationState);
405             } catch (InvalidDatatypeFacetException ex) {
406                 reportSchemaError(ex.getKey(), ex.getArgs(), child);
407                 // Recreate the type, ignoring the facets
408                 newDecl = fSchemaHandler.fDVFactory.createTypeRestriction(name, schemaDoc.fTargetNamespace, (short)finalProperty, baseValidator,
409                         annotations == null? null : new XSObjectListImpl(annotations, annotations.length));
410             }
411         }
412         // no element should appear after this point
413         if (content != null) {
414             if (restriction) {
415                 reportSchemaError("s4s-elt-must-match.1", new Object[]{SchemaSymbols.ELT_RESTRICTION, "(annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*))", DOMUtil.getLocalName(content)}, content);
416             }
417             else if (list) {
418                 reportSchemaError("s4s-elt-must-match.1", new Object[]{SchemaSymbols.ELT_LIST, "(annotation?, (simpleType?))", DOMUtil.getLocalName(content)}, content);
419             }
420             else if (union) {
421                 reportSchemaError("s4s-elt-must-match.1", new Object[]{SchemaSymbols.ELT_UNION, "(annotation?, (simpleType*))", DOMUtil.getLocalName(content)}, content);
422             }
423         }
424         fAttrChecker.returnAttrArray(contentAttrs, schemaDoc);
425         // return the new type
426         return newDecl;
427     }
428 
429     //@param: elm - top element
430     //@param: baseTypeStr - type (base/itemType/memberTypes)
431     //@param: baseRefContext:  whether the caller is using this type as a base for restriction, union or list
432     //return XSSimpleType available for the baseTypeStr, null if not found or disallowed.
433     // also throws an error if the base type won't allow itself to be used in this context.
434     // REVISIT: can this code be re-used?
435     private XSSimpleType findDTValidator(Element elm, String refName,
436             QName baseTypeStr, short baseRefContext,
437             XSDocumentInfo schemaDoc) {
438         if (baseTypeStr == null)
439             return null;
440 
441         XSTypeDefinition baseType = (XSTypeDefinition)fSchemaHandler.getGlobalDecl(schemaDoc, XSDHandler.TYPEDECL_TYPE, baseTypeStr, elm);
442         if (baseType == null) {
443             return null;
444         }
445         if (baseType.getTypeCategory() != XSTypeDefinition.SIMPLE_TYPE) {
446             reportSchemaError("cos-st-restricts.1.1", new Object[]{baseTypeStr.rawname, refName}, elm);
447             return null;
448         }
449 
450         // if it's a complex type, or if its restriction of anySimpleType
451         if (baseType == SchemaGrammar.fAnySimpleType &&
452             baseRefContext == XSConstants.DERIVATION_RESTRICTION) {
453             // if the base type is anySimpleType and the current type is
454             // a S4S built-in type, return null. (not an error).
455             if (checkBuiltIn(refName, schemaDoc.fTargetNamespace)) {
456                 return null;
457             }
458             reportSchemaError("cos-st-restricts.1.1", new Object[]{baseTypeStr.rawname, refName}, elm);
459             return null;
460         }
461 
462         if ((baseType.getFinal() & baseRefContext) != 0) {
463             if (baseRefContext == XSConstants.DERIVATION_RESTRICTION) {
464                 reportSchemaError("st-props-correct.3", new Object[]{refName, baseTypeStr.rawname}, elm);
465             }
466             else if (baseRefContext == XSConstants.DERIVATION_LIST) {
467                 reportSchemaError("cos-st-restricts.2.3.1.1", new Object[]{baseTypeStr.rawname, refName}, elm);
468             }
469             else if (baseRefContext == XSConstants.DERIVATION_UNION) {
470                 reportSchemaError("cos-st-restricts.3.3.1.1", new Object[]{baseTypeStr.rawname, refName}, elm);
471             }
472             return null;
473         }
474 
475         return (XSSimpleType)baseType;
476     }
477 
478     // check whethe the type denoted by the name and namespace is a S4S
479     // built-in type. update fIsBuiltIn at the same time.
480     private final boolean checkBuiltIn(String name, String namespace) {
481         if (namespace != SchemaSymbols.URI_SCHEMAFORSCHEMA)
482             return false;
483         if (SchemaGrammar.SG_SchemaNS.getGlobalTypeDecl(name) != null)
484             fIsBuiltIn = true;
485         return fIsBuiltIn;
486     }
487 
488     // find if a datatype validator is a list or has list datatype member.
489     private boolean isListDatatype(XSSimpleType validator) {
490         if (validator.getVariety() == XSSimpleType.VARIETY_LIST)
491             return true;
492 
493         if (validator.getVariety() == XSSimpleType.VARIETY_UNION) {
494             XSObjectList temp = validator.getMemberTypes();
495             for (int i = 0; i < temp.getLength(); i++) {
496                 if (((XSSimpleType)temp.item(i)).getVariety() == XSSimpleType.VARIETY_LIST) {
497                     return true;
498                 }
499             }
500         }
501 
502         return false;
503     }//isListDatatype(XSSimpleTypeDecl):boolean
504 
505     private XSSimpleType errorType(String name, String namespace, short refType) {
506         XSSimpleType stringType = (XSSimpleType)SchemaGrammar.SG_SchemaNS.getTypeDefinition("string");
507         switch (refType) {
508         case XSConstants.DERIVATION_RESTRICTION:
509             return fSchemaHandler.fDVFactory.createTypeRestriction(name, namespace, (short)0,
510                     stringType, null);
511         case XSConstants.DERIVATION_LIST:
512             return fSchemaHandler.fDVFactory.createTypeList(name, namespace, (short)0,
513                     stringType, null);
514         case XSConstants.DERIVATION_UNION:
515             return fSchemaHandler.fDVFactory.createTypeUnion(name, namespace, (short)0,
516                     new XSSimpleType[]{stringType}, null);
517         }
518 
519         return null;
520     }
521 
522 }//class XSDSimpleTypeTraverser