/** * Traverse the Sequence declaration * * <sequence * id = ID * maxOccurs = string * minOccurs = nonNegativeInteger> * Content: (annotation? , (element | group | choice | sequence | any)*) * </sequence> * * @param seqDecl * @param schemaDoc * @param grammar * @return */ XSParticleDecl traverseSequence(Element seqDecl, XSDocumentInfo schemaDoc, SchemaGrammar grammar, int allContextFlags, XSObject parent) { return traverseSeqChoice(seqDecl, schemaDoc, grammar, allContextFlags, false, parent); }
XSAnnotationImpl annotation = null; if (child !=null && DOMUtil.getLocalName(child).equals(SchemaSymbols.ELT_ANNOTATION)) { annotation = traverseAnnotationDecl(child, attrValues, false, schemaDoc); child = DOMUtil.getNextSiblingElement(child); String text = DOMUtil.getSyntheticAnnotation(decl); if (text != null) { annotation = traverseSyntheticAnnotation(decl, text, attrValues, false, schemaDoc); if (hasAllContent(particle)) { reportSchemaError("cos-all-limited.1.2", null, child); particle = traverseChoice(child, schemaDoc, grammar, NOT_ALL_CONTEXT, parent); particle = traverseSequence(child, schemaDoc, grammar, NOT_ALL_CONTEXT, parent); args = new Object[]{"sequence", "(annotation?, (element | group | choice | sequence | any)*)", DOMUtil.getLocalName(child)}; reportSchemaError("s4s-elt-must-match.1", args, child); particle.fAnnotations = annotations; particle = checkOccurrences(particle, choice ? SchemaSymbols.ELT_CHOICE : SchemaSymbols.ELT_SEQUENCE, (Element)decl.getParentNode(),
annotation = traverseAnnotationDecl(child, attrValues, false, schemaDoc); child = DOMUtil.getNextSiblingElement(child); String text = DOMUtil.getSyntheticAnnotation(allDecl); if (text != null) { annotation = traverseSyntheticAnnotation(allDecl, text, attrValues, false, schemaDoc); XInt groupMaxAttr = (XInt) groupAttrValues[XSAttributeChecker.ATTIDX_MAXOCCURS]; if (!(groupMinAttr.intValue() == 1 && groupMaxAttr.intValue() == 1)) { reportSchemaError("cos-all-limited.1.3", null, child); expandGroupParticleForCompositorAll(particle, child); reportSchemaError("s4s-elt-must-match.1", args, child); reportSchemaError("s4s-elt-must-match.1", args, child); particle.fAnnotations = annotations; particle = checkOccurrences(particle, SchemaSymbols.ELT_ALL, (Element)allDecl.getParentNode(),
private void expandGroupParticleForCompositorAll(XSParticleDecl particle, Element contextElement) { XSModelGroupImpl group = (XSModelGroupImpl) particle.fValue; if (group.getCompositor() == XSModelGroup.COMPOSITOR_ALL) { XSParticleDecl[] subParticles = group.fParticles; for (int partlIdx = 0; partlIdx < group.fParticleCount; partlIdx++) { short particleType = subParticles[partlIdx].fType; if (particleType == XSParticleDecl.PARTICLE_ELEMENT || particleType == XSParticleDecl.PARTICLE_WILDCARD) { fPArray.addParticle(subParticles[partlIdx]); } else { // the sub particle is a model-group. call the method recursively. expandGroupParticleForCompositorAll(subParticles[partlIdx], contextElement); } } } else { String wrongCompsName = (group.getCompositor() == XSModelGroup.COMPOSITOR_SEQUENCE) ? "xs:"+SchemaSymbols.ELT_SEQUENCE : "xs:"+SchemaSymbols.ELT_CHOICE; // it's an error to have a non-all (xs:all) compositor within "xs:all -> xs:group" reportSchemaError("cos-all-limited.2-xs11", new Object[] { wrongCompsName }, contextElement); } } // expandGroupParticleForCompositorAll
/** * Traverse the Choice declaration * * <choice * id = ID * maxOccurs = string * minOccurs = nonNegativeInteger> * Content: (annotation? , (element | group | choice | sequence | any)*) * </choice> * * @param choiceDecl * @param schemaDoc * @param grammar * @return */ XSParticleDecl traverseChoice(Element choiceDecl, XSDocumentInfo schemaDoc, SchemaGrammar grammar, int allContextFlags, XSObject parent) { return traverseSeqChoice (choiceDecl, schemaDoc, grammar, allContextFlags, true, parent); }