XSDAbstractParticleTraverserpublic abstract class XSDAbstractParticleTraverser extends XSDAbstractTraverser
Fields Summary |
---|
ParticleArray | fPArray |
Methods Summary |
---|
protected boolean | hasAllContent(com.sun.org.apache.xerces.internal.impl.xs.XSParticleDecl particle)
// If the content is not empty, is the top node ALL?
if (particle != null && particle.fType == XSParticleDecl.PARTICLE_MODELGROUP) {
return ((XSModelGroupImpl)particle.fValue).fCompositor == XSModelGroupImpl.MODELGROUP_ALL;
}
return false;
| com.sun.org.apache.xerces.internal.impl.xs.XSParticleDecl | traverseAll(org.w3c.dom.Element allDecl, com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDocumentInfo schemaDoc, com.sun.org.apache.xerces.internal.impl.xs.SchemaGrammar grammar, int allContextFlags, com.sun.org.apache.xerces.internal.xs.XSObject parent)Traverse the "All" declaration
Content: (annotation? , element*)
// General Attribute Checking
Object[] attrValues = fAttrChecker.checkAttributes(allDecl, false, schemaDoc);
Element child = DOMUtil.getFirstChildElement(allDecl);
XSAnnotationImpl annotation = null;
if (child !=null && DOMUtil.getLocalName(child).equals(SchemaSymbols.ELT_ANNOTATION)) {
annotation = traverseAnnotationDecl(child, attrValues, false, schemaDoc);
child = DOMUtil.getNextSiblingElement(child);
}
else {
String text = DOMUtil.getSyntheticAnnotation(allDecl);
if (text != null) {
annotation = traverseSyntheticAnnotation(allDecl, text, attrValues, false, schemaDoc);
}
}
String childName = null;
XSParticleDecl particle;
fPArray.pushContext();
for (; child != null; child = DOMUtil.getNextSiblingElement(child)) {
particle = null;
childName = DOMUtil.getLocalName(child);
// Only elements are allowed in <all>
if (childName.equals(SchemaSymbols.ELT_ELEMENT)) {
particle = fSchemaHandler.fElementTraverser.traverseLocal(child, schemaDoc, grammar, PROCESSING_ALL_EL, parent);
}
else {
Object[] args = {"all", "(annotation?, element*)", DOMUtil.getLocalName(child)};
reportSchemaError("s4s-elt-must-match.1", args, child);
}
if (particle != null)
fPArray.addParticle(particle);
}
particle = null;
XInt minAtt = (XInt)attrValues[XSAttributeChecker.ATTIDX_MINOCCURS];
XInt maxAtt = (XInt)attrValues[XSAttributeChecker.ATTIDX_MAXOCCURS];
Long defaultVals = (Long)attrValues[XSAttributeChecker.ATTIDX_FROMDEFAULT];
XSModelGroupImpl group = new XSModelGroupImpl();
group.fCompositor = XSModelGroupImpl.MODELGROUP_ALL;
group.fParticleCount = fPArray.getParticleCount();
group.fParticles = fPArray.popContext();
group.fAnnotation = annotation;
particle = new XSParticleDecl();
particle.fType = XSParticleDecl.PARTICLE_MODELGROUP;
particle.fMinOccurs = minAtt.intValue();
particle.fMaxOccurs = maxAtt.intValue();
particle.fValue = group;
particle = checkOccurrences(particle,
SchemaSymbols.ELT_ALL,
(Element)allDecl.getParentNode(),
allContextFlags,
defaultVals.longValue());
fAttrChecker.returnAttrArray(attrValues, schemaDoc);
return particle;
| com.sun.org.apache.xerces.internal.impl.xs.XSParticleDecl | traverseChoice(org.w3c.dom.Element choiceDecl, com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDocumentInfo schemaDoc, com.sun.org.apache.xerces.internal.impl.xs.SchemaGrammar grammar, int allContextFlags, com.sun.org.apache.xerces.internal.xs.XSObject parent)Traverse the Choice declaration
Content: (annotation? , (element | group | choice | sequence | any)*)
return traverseSeqChoice (choiceDecl, schemaDoc, grammar, allContextFlags, true, parent);
| private com.sun.org.apache.xerces.internal.impl.xs.XSParticleDecl | traverseSeqChoice(org.w3c.dom.Element decl, com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDocumentInfo schemaDoc, com.sun.org.apache.xerces.internal.impl.xs.SchemaGrammar grammar, int allContextFlags, boolean choice, com.sun.org.apache.xerces.internal.xs.XSObject parent)Common traversal for and
// General Attribute Checking
Object[] attrValues = fAttrChecker.checkAttributes(decl, false, schemaDoc);
Element child = DOMUtil.getFirstChildElement(decl);
XSAnnotationImpl annotation = null;
if (child !=null && DOMUtil.getLocalName(child).equals(SchemaSymbols.ELT_ANNOTATION)) {
annotation = traverseAnnotationDecl(child, attrValues, false, schemaDoc);
child = DOMUtil.getNextSiblingElement(child);
}
else {
String text = DOMUtil.getSyntheticAnnotation(decl);
if (text != null) {
annotation = traverseSyntheticAnnotation(decl, text, attrValues, false, schemaDoc);
}
}
boolean hadContent = false;
String childName = null;
XSParticleDecl particle;
fPArray.pushContext();
for (;child != null;child = DOMUtil.getNextSiblingElement(child)) {
particle = null;
childName = DOMUtil.getLocalName(child);
if (childName.equals(SchemaSymbols.ELT_ELEMENT)) {
particle = fSchemaHandler.fElementTraverser.traverseLocal(child, schemaDoc, grammar, NOT_ALL_CONTEXT, parent);
}
else if (childName.equals(SchemaSymbols.ELT_GROUP)) {
particle = fSchemaHandler.fGroupTraverser.traverseLocal(child, schemaDoc, grammar);
// A content type of all can only appear
// as the content type of a complex type definition.
if (hasAllContent(particle)) {
// don't insert the "all" particle, otherwise we won't be
// able to create DFA from this content model
particle = null;
reportSchemaError("cos-all-limited.1.2", null, child);
}
}
else if (childName.equals(SchemaSymbols.ELT_CHOICE)) {
particle = traverseChoice(child, schemaDoc, grammar, NOT_ALL_CONTEXT, parent);
}
else if (childName.equals(SchemaSymbols.ELT_SEQUENCE)) {
particle = traverseSequence(child, schemaDoc, grammar, NOT_ALL_CONTEXT, parent);
}
else if (childName.equals(SchemaSymbols.ELT_ANY)) {
particle = fSchemaHandler.fWildCardTraverser.traverseAny(child, schemaDoc, grammar);
}
else {
Object [] args;
if (choice) {
args = new Object[]{"choice", "(annotation?, (element | group | choice | sequence | any)*)", DOMUtil.getLocalName(child)};
}
else {
args = new Object[]{"sequence", "(annotation?, (element | group | choice | sequence | any)*)", DOMUtil.getLocalName(child)};
}
reportSchemaError("s4s-elt-must-match.1", args, child);
}
if (particle != null)
fPArray.addParticle(particle);
}
particle = null;
XInt minAtt = (XInt)attrValues[XSAttributeChecker.ATTIDX_MINOCCURS];
XInt maxAtt = (XInt)attrValues[XSAttributeChecker.ATTIDX_MAXOCCURS];
Long defaultVals = (Long)attrValues[XSAttributeChecker.ATTIDX_FROMDEFAULT];
XSModelGroupImpl group = new XSModelGroupImpl();
group.fCompositor = choice ? XSModelGroupImpl.MODELGROUP_CHOICE : XSModelGroupImpl.MODELGROUP_SEQUENCE;
group.fParticleCount = fPArray.getParticleCount();
group.fParticles = fPArray.popContext();
group.fAnnotation = annotation;
particle = new XSParticleDecl();
particle.fType = XSParticleDecl.PARTICLE_MODELGROUP;
particle.fMinOccurs = minAtt.intValue();
particle.fMaxOccurs = maxAtt.intValue();
particle.fValue = group;
particle = checkOccurrences(particle,
choice ? SchemaSymbols.ELT_CHOICE : SchemaSymbols.ELT_SEQUENCE,
(Element)decl.getParentNode(),
allContextFlags,
defaultVals.longValue());
fAttrChecker.returnAttrArray(attrValues, schemaDoc);
return particle;
| com.sun.org.apache.xerces.internal.impl.xs.XSParticleDecl | traverseSequence(org.w3c.dom.Element seqDecl, com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDocumentInfo schemaDoc, com.sun.org.apache.xerces.internal.impl.xs.SchemaGrammar grammar, int allContextFlags, com.sun.org.apache.xerces.internal.xs.XSObject parent)Traverse the Sequence declaration
Content: (annotation? , (element | group | choice | sequence | any)*)
return traverseSeqChoice(seqDecl, schemaDoc, grammar, allContextFlags, false, parent);
|
|