1 57 58 package com.sun.org.apache.xerces.internal.impl.xs.traversers; 59 60 import com.sun.org.apache.xerces.internal.impl.xs.SchemaGrammar; 61 import com.sun.org.apache.xerces.internal.impl.xs.SchemaSymbols; 62 import com.sun.org.apache.xerces.internal.impl.xs.XSAnnotationImpl; 63 import com.sun.org.apache.xerces.internal.impl.xs.XSParticleDecl; 64 import com.sun.org.apache.xerces.internal.impl.xs.XSWildcardDecl; 65 import com.sun.org.apache.xerces.internal.impl.xs.util.XInt; 66 import com.sun.org.apache.xerces.internal.util.DOMUtil; 67 import org.w3c.dom.Element ; 68 69 95 class XSDWildcardTraverser extends XSDAbstractTraverser { 96 97 104 XSDWildcardTraverser (XSDHandler handler, 105 XSAttributeChecker gAttrCheck) { 106 super(handler, gAttrCheck); 107 } 108 109 110 118 XSParticleDecl traverseAny(Element elmNode, 119 XSDocumentInfo schemaDoc, 120 SchemaGrammar grammar) { 121 122 Object [] attrValues = fAttrChecker.checkAttributes(elmNode, false, schemaDoc); 124 XSWildcardDecl wildcard = traverseWildcardDecl(elmNode, attrValues, schemaDoc, grammar); 125 126 XSParticleDecl particle = null; 128 if (wildcard != null) { 129 int min = ((XInt)attrValues[XSAttributeChecker.ATTIDX_MINOCCURS]).intValue(); 130 int max = ((XInt)attrValues[XSAttributeChecker.ATTIDX_MAXOCCURS]).intValue(); 131 if (max != 0) { 132 if (fSchemaHandler.fDeclPool !=null) { 133 particle = fSchemaHandler.fDeclPool.getParticleDecl(); 134 } else { 135 particle = new XSParticleDecl(); 136 } 137 particle.fType = XSParticleDecl.PARTICLE_WILDCARD; 138 particle.fValue = wildcard; 139 particle.fMinOccurs = min; 140 particle.fMaxOccurs = max; 141 } 142 } 143 144 fAttrChecker.returnAttrArray(attrValues, schemaDoc); 145 146 return particle; 147 } 148 149 150 158 XSWildcardDecl traverseAnyAttribute(Element elmNode, 159 XSDocumentInfo schemaDoc, 160 SchemaGrammar grammar) { 161 162 Object [] attrValues = fAttrChecker.checkAttributes(elmNode, false, schemaDoc); 164 XSWildcardDecl wildcard = traverseWildcardDecl(elmNode, attrValues, schemaDoc, grammar); 165 fAttrChecker.returnAttrArray(attrValues, schemaDoc); 166 167 return wildcard; 168 } 169 170 171 179 XSWildcardDecl traverseWildcardDecl(Element elmNode, 180 Object [] attrValues, 181 XSDocumentInfo schemaDoc, 182 SchemaGrammar grammar) { 183 184 XSWildcardDecl wildcard = new XSWildcardDecl(); 186 XInt namespaceTypeAttr = (XInt) attrValues[XSAttributeChecker.ATTIDX_NAMESPACE]; 188 wildcard.fType = namespaceTypeAttr.shortValue(); 189 wildcard.fNamespaceList = (String [])attrValues[XSAttributeChecker.ATTIDX_NAMESPACE_LIST]; 191 XInt processContentsAttr = (XInt) attrValues[XSAttributeChecker.ATTIDX_PROCESSCONTENTS]; 193 wildcard.fProcessContents = processContentsAttr.shortValue(); 194 195 Element child = DOMUtil.getFirstChildElement(elmNode); 197 XSAnnotationImpl annotation = null; 198 if (child != null) 199 { 200 if (DOMUtil.getLocalName(child).equals(SchemaSymbols.ELT_ANNOTATION)) { 201 annotation = traverseAnnotationDecl(child, attrValues, false, schemaDoc); 202 child = DOMUtil.getNextSiblingElement(child); 203 } 204 205 if (child != null) { 206 reportSchemaError("s4s-elt-must-match.1", new Object []{"wildcard", "(annotation?)", DOMUtil.getLocalName(child)}, elmNode); 207 } 208 } 209 wildcard.fAnnotation = annotation; 210 211 return wildcard; 212 213 } 215 } | Popular Tags |