/** * Traverse local complexType declarations * * @param Element * @param XSDocumentInfo * @param SchemaGrammar * @return XSComplexTypeDecl */ XSComplexTypeDecl traverseLocal(Element complexTypeNode, XSDocumentInfo schemaDoc, SchemaGrammar grammar, XSObject context) { Object[] attrValues = fAttrChecker.checkAttributes(complexTypeNode, false, schemaDoc); String complexTypeName = genAnonTypeName(complexTypeNode); contentBackup(); XSComplexTypeDecl type = traverseComplexTypeDecl (complexTypeNode, complexTypeName, attrValues, schemaDoc, grammar, context); contentRestore(); // need to add the type to the grammar for later constraint checking grammar.addComplexTypeDecl(type, fSchemaHandler.element2Locator(complexTypeNode)); type.setIsAnonymous(); fAttrChecker.returnAttrArray(attrValues, schemaDoc); return type; }
private void handleComplexTypeError(String messageId,Object[] args, Element e) { if (messageId!=null) { reportSchemaError(messageId, args, e); } // // Mock up the typeInfo structure so that there won't be problems during // validation // fBaseType = SchemaGrammar.getXSAnyType(fSchemaHandler.fSchemaVersion); fContentType = XSComplexTypeDecl.CONTENTTYPE_MIXED; fXSSimpleType = null; fParticle = getErrorContent(); // REVISIT: do we need to remove all attribute uses already added into // the attribute group? maybe it's ok to leave them there. -SG fAttrGrp.fAttributeWC = getErrorWildcard(); }
addAnnotation(traverseAnnotationDecl(simpleContent, simpleContentAttrValues, false, schemaDoc)); simpleContent = DOMUtil.getNextSiblingElement(simpleContent); String text = DOMUtil.getSyntheticAnnotation(simpleContentElement); if (text != null) { addAnnotation(traverseSyntheticAnnotation(simpleContentElement, text, simpleContentAttrValues, false, schemaDoc)); addAnnotation(traverseAnnotationDecl(simpleContent, derivationTypeAttrValues, false, schemaDoc)); simpleContent = DOMUtil.getNextSiblingElement(simpleContent); String text = DOMUtil.getSyntheticAnnotation(scElement); if (text != null) { addAnnotation(traverseSyntheticAnnotation(scElement, text, derivationTypeAttrValues, false, schemaDoc)); String text = DOMUtil.getSyntheticAnnotation(scElement); if (text != null) { addAnnotation(traverseSyntheticAnnotation(scElement, text, derivationTypeAttrValues, false, schemaDoc)); addAssertsFromBaseTypes(fBaseType); fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc); throw new ComplexTypeRecoverableError("cos-st-restricts.1.1", new Object[]{baseValidator.getName(), genAnonTypeName(simpleContentElement)}, simpleContentElement); FacetInfo fi = traverseFacets(simpleContent, fComplexTypeDecl, baseValidator, schemaDoc); attrOrAssertNode = fi.nodeAfterFacets; facetData = fi.facetdata; String name = genAnonTypeName(simpleContentElement);
mergeAttributes(schemaDoc.fDefaultAGroup, fAttrGrp, fName, true, complexTypeDecl); if(child != null) { if (DOMUtil.getLocalName(child).equals(SchemaSymbols.ELT_ANNOTATION)) { addAnnotation(traverseAnnotationDecl(child, attrValues, false, schemaDoc)); child = DOMUtil.getNextSiblingElement(child); String text = DOMUtil.getSyntheticAnnotation(complexTypeDecl); if (text != null) { addAnnotation(traverseSyntheticAnnotation(complexTypeDecl, text, attrValues, false, schemaDoc)); String text = DOMUtil.getSyntheticAnnotation(complexTypeDecl); if (text != null) { addAnnotation(traverseSyntheticAnnotation(complexTypeDecl, text, attrValues, false, schemaDoc)); processComplexContent(child, mixedAtt.booleanValue(), false, schemaDoc, grammar); traverseSimpleContent(child, schemaDoc, grammar); Element elemTmp = DOMUtil.getNextSiblingElement(child); if (elemTmp != null) { final boolean mixedAttPresent = (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1) ? DOMUtil.getAttr(complexTypeDecl, SchemaSymbols.ATT_MIXED) != null : false; traverseComplexContent(child, mixedAtt.booleanValue(), mixedAttPresent, schemaDoc, grammar); Element elemTmp = DOMUtil.getNextSiblingElement(child); processComplexContent(child, mixedAtt.booleanValue(), false,
addAnnotation(traverseAnnotationDecl(complexContent, complexContentAttrValues, false, schemaDoc)); complexContent = DOMUtil.getNextSiblingElement(complexContent); String text = DOMUtil.getSyntheticAnnotation(complexContentElement); if (text != null) { addAnnotation(traverseSyntheticAnnotation(complexContentElement, text, complexContentAttrValues, false, schemaDoc)); addAnnotation(traverseAnnotationDecl(complexContent, derivationTypeAttrValues, false, schemaDoc)); complexContent = DOMUtil.getNextSiblingElement(complexContent); String text = DOMUtil.getSyntheticAnnotation(complexContent); if (text != null) { addAnnotation(traverseSyntheticAnnotation(complexContent, text, derivationTypeAttrValues, false, schemaDoc)); String text = DOMUtil.getSyntheticAnnotation(complexContent); if (text != null) { addAnnotation(traverseSyntheticAnnotation(complexContent, text, derivationTypeAttrValues, false, schemaDoc)); addAssertsFromBaseTypes(fBaseType); processComplexContent(complexContent, mixedContent, true, schemaDoc, grammar); } catch (ComplexTypeRecoverableError e) { mergeAttributes(baseType.getAttrGrp(), fAttrGrp, fName, false, complexContent); } catch (ComplexTypeRecoverableError e) { fAttrChecker.returnAttrArray(complexContentAttrValues, schemaDoc); mergeAttributes(baseType.getAttrGrp(), fAttrGrp, fName, true, complexContent);
schemaDoc); String complexTypeName = (String) attrValues[XSAttributeChecker.ATTIDX_NAME]; contentBackup(); XSComplexTypeDecl type = traverseComplexTypeDecl (complexTypeNode, complexTypeName, attrValues, schemaDoc, grammar, null); contentRestore(); reportSchemaError("s4s-att-must-appear", new Object[]{SchemaSymbols.ELT_COMPLEXTYPE, SchemaSymbols.ATT_NAME}, complexTypeNode); type = null; } else {
if (child != null) { if (DOMUtil.getLocalName(child).equals(SchemaSymbols.ELT_ANNOTATION)) { addAnnotation(traverseAnnotationDecl(child, attrValues, false, schemaDoc)); child = DOMUtil.getNextSiblingElement(child); String text = DOMUtil.getSyntheticAnnotation(elmNode); if (text != null) { addAnnotation(traverseSyntheticAnnotation(elmNode, text, attrValues, false, schemaDoc)); reportSchemaError("s4s-elt-invalid-content.1", new Object[]{SchemaSymbols.ELT_OPENCONTENT,SchemaSymbols.ELT_ANNOTATION}, child); String text = DOMUtil.getSyntheticAnnotation(elmNode); if (text != null) { addAnnotation(traverseSyntheticAnnotation(elmNode, text, attrValues, false, schemaDoc)); reportSchemaError("src-ct.6", new Object[]{fName}, elmNode); if (!childName.equals(SchemaSymbols.ELT_ANY) || DOMUtil.getNextSiblingElement(child) != null) { reportSchemaError("s4s-elt-must-match.1", new Object[]{SchemaSymbols.ELT_OPENCONTENT, "(annotation?, any?)", childName}, child); fAttrChecker.returnAttrArray(attrValues, schemaDoc); reportSchemaError("s4s-att-not-allowed", new Object[]{DOMUtil.getLocalName(elmNode)+"=>"+SchemaSymbols.ELT_ANY, SchemaSymbols.ATT_MINOCCURS+"|"+SchemaSymbols.ATT_MAXOCCURS}, child); if (ocMode == XSOpenContentDecl.MODE_NONE) { ocDecl.fWildcard = null; reportSchemaError("src-ct11.3", new Object[]{fName}, elmNode);
annotation = traverseAnnotationDecl(childNode, attrValues, false, schemaDoc); reportSchemaError("s4s-elt-invalid-content.1", new Object[] { DOMUtil.getLocalName(assertElement), DOMUtil.getLocalName(childNode) }, childNode); String text = DOMUtil.getSyntheticAnnotation(childNode); if (text != null) { annotation = traverseSyntheticAnnotation(childNode, text, attrValues, false, schemaDoc); String xpathDefaultNamespace = getXPathDefaultNamespaceForAssert(assertElement, schemaDoc, attrValues); assertImpl.setTest(testExpr, assertElement); assertImpl.setXPathDefaultNamespace(xpathDefaultNamespace); addAssertion(assertImpl); if (sibling.getLocalName().equals(SchemaSymbols.ELT_ASSERT)) { traverseAsserts(sibling, schemaDoc, grammar, enclosingCT); } else { reportSchemaError("src-assert.3.13.1", new Object[] { DOMUtil.getLocalName(assertElement), XS11TypeHelper.getSchemaTypeName(enclosingCT) }, assertElement);
private static XSParticleDecl getErrorContent() { if (fErrorContent == null) { XSParticleDecl particle = new XSParticleDecl(); particle.fType = XSParticleDecl.PARTICLE_WILDCARD; particle.fValue = getErrorWildcard(); particle.fMinOccurs = 0; particle.fMaxOccurs = SchemaSymbols.OCCURRENCE_UNBOUNDED; XSModelGroupImpl group = new XSModelGroupImpl(); group.fCompositor = XSModelGroupImpl.MODELGROUP_SEQUENCE; group.fParticleCount = 1; group.fParticles = new XSParticleDecl[1]; group.fParticles[0] = particle; XSParticleDecl errorContent = new XSParticleDecl(); errorContent.fType = XSParticleDecl.PARTICLE_MODELGROUP; errorContent.fValue = group; fErrorContent = errorContent; } return fErrorContent; } private static XSWildcardDecl getErrorWildcard() {
private void createTraversers() { fAttributeChecker = new XSAttributeChecker(this); fAttributeGroupTraverser = new XSDAttributeGroupTraverser(this, fAttributeChecker); fAttributeTraverser = new XSDAttributeTraverser(this, fAttributeChecker); fComplexTypeTraverser = new XSDComplexTypeTraverser(this, fAttributeChecker); fElementTraverser = new XSDElementTraverser(this, fAttributeChecker); fGroupTraverser = new XSDGroupTraverser(this, fAttributeChecker); fKeyrefTraverser = new XSDKeyrefTraverser(this, fAttributeChecker); fNotationTraverser = new XSDNotationTraverser(this, fAttributeChecker); fSimpleTypeTraverser = new XSDSimpleTypeTraverser(this, fAttributeChecker); fUniqueOrKeyTraverser = new XSDUniqueOrKeyTraverser(this, fAttributeChecker); fWildCardTraverser = new XSDWildcardTraverser(this, fAttributeChecker); } // createTraversers()
for (int assertLstIdx = 0; assertLstIdx < assertList.size(); assertLstIdx++) { if (!assertExists((XSAssertImpl) assertList.get(assertLstIdx))) { addAssertion((XSAssertImpl) assertList.get(assertLstIdx)); for (int j = 0; j < assertionFacets.size(); j++) { XSAssertImpl assertImpl = (XSAssertImpl)assertionFacets.get(j); addAssertion(assertImpl); addAssertsFromBaseTypes(ancestorType);