XSDAbstractParticleTraverserpublic abstract class XSDAbstractParticleTraverser extends XSDAbstractTraverser
Fields Summary |
---|
ParticleArray | fPArray |
Methods Summary |
---|
protected boolean | hasAllContent(org.apache.xerces.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;
| org.apache.xerces.impl.xs.XSParticleDecl | traverseAll(org.w3c.dom.Element allDecl, XSDocumentInfo schemaDoc, org.apache.xerces.impl.xs.SchemaGrammar grammar, int allContextFlags, org.apache.xerces.xs.XSObject parent)Traverse the "All" declaration
<all
id = ID
maxOccurs = 1 : 1
minOccurs = (0 | 1) : 1>
Content: (annotation? , element*)
</all>
// 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();
XSObjectList annotations;
if (annotation != null) {
annotations = new XSObjectListImpl();
((XSObjectListImpl)annotations).add (annotation);
} else {
annotations = XSObjectListImpl.EMPTY_LIST;
}
group.fAnnotations = annotations;
particle = new XSParticleDecl();
particle.fType = XSParticleDecl.PARTICLE_MODELGROUP;
particle.fMinOccurs = minAtt.intValue();
particle.fMaxOccurs = maxAtt.intValue();
particle.fValue = group;
particle.fAnnotations = annotations;
particle = checkOccurrences(particle,
SchemaSymbols.ELT_ALL,
(Element)allDecl.getParentNode(),
allContextFlags,
defaultVals.longValue());
fAttrChecker.returnAttrArray(attrValues, schemaDoc);
return particle;
| org.apache.xerces.impl.xs.XSParticleDecl | traverseChoice(org.w3c.dom.Element choiceDecl, XSDocumentInfo schemaDoc, org.apache.xerces.impl.xs.SchemaGrammar grammar, int allContextFlags, org.apache.xerces.xs.XSObject parent)Traverse the Choice declaration
Content: (annotation? , (element | group | choice | sequence | any)*)
return traverseSeqChoice (choiceDecl, schemaDoc, grammar, allContextFlags, true, parent);
| private org.apache.xerces.impl.xs.XSParticleDecl | traverseSeqChoice(org.w3c.dom.Element decl, XSDocumentInfo schemaDoc, org.apache.xerces.impl.xs.SchemaGrammar grammar, int allContextFlags, boolean choice, org.apache.xerces.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);
}
}
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();
XSObjectList annotations;
if (annotation != null) {
annotations = new XSObjectListImpl();
((XSObjectListImpl)annotations).add (annotation);
} else {
annotations = XSObjectListImpl.EMPTY_LIST;
}
group.fAnnotations = annotations;
particle = new XSParticleDecl();
particle.fType = XSParticleDecl.PARTICLE_MODELGROUP;
particle.fMinOccurs = minAtt.intValue();
particle.fMaxOccurs = maxAtt.intValue();
particle.fValue = group;
particle.fAnnotations = annotations;
particle = checkOccurrences(particle,
choice ? SchemaSymbols.ELT_CHOICE : SchemaSymbols.ELT_SEQUENCE,
(Element)decl.getParentNode(),
allContextFlags,
defaultVals.longValue());
fAttrChecker.returnAttrArray(attrValues, schemaDoc);
return particle;
| org.apache.xerces.impl.xs.XSParticleDecl | traverseSequence(org.w3c.dom.Element seqDecl, XSDocumentInfo schemaDoc, org.apache.xerces.impl.xs.SchemaGrammar grammar, int allContextFlags, org.apache.xerces.xs.XSObject parent)Traverse the Sequence declaration
Content: (annotation? , (element | group | choice | sequence | any)*)
return traverseSeqChoice(seqDecl, schemaDoc, grammar, allContextFlags, false, parent);
|
|