gatherAllLeaves ((XSParticleDecl)(particle.fOtherValue), allContent);
return allContent;
}
else if (type == XSParticleDecl.PARTICLE_ZERO_OR_ONE) {
XSParticleDecl left = (XSParticleDecl)particle.fValue;
// An ALL node can appear under a ZERO_OR_ONE node.
if (type ==XSParticleDecl.PARTICLE_ALL) {
XSAllCM allContent = new XSAllCM(true);
gatherAllLeaves (left, allContent);
return allContent;
}
}
// otherwise, let fall through to build a DFAContentModel
}
else if (type == XSParticleDecl.PARTICLE_ELEMENT) {
//
// Check that the left value is not null, since any content model
// with PCDATA should be MIXED, so we should not have gotten here.
//
if (particle.fValue == null &&
particle.fOtherValue == null)
throw new RuntimeException("ImplementationMessages.VAL_NPCD");
//
// Its a single leaf, so its an 'a' type of content model, i.e.
// just one instance of one element. That one is definitely a
// simple content model.
//
// pass element declaration
return new XSSimpleCM(type, (XSElementDecl)particle.fValue);
}
else if ((type == XSParticleDecl.PARTICLE_CHOICE)
|| (type == XSParticleDecl.PARTICLE_SEQUENCE)) {
//
// Lets see if both of the children are leafs. If so, then it
// it has to be a simple content model
//
XSParticleDecl left = (XSParticleDecl)particle.fValue;
XSParticleDecl right = (XSParticleDecl)particle.fOtherValue;
if ((right.fType == XSParticleDecl.PARTICLE_ELEMENT)
&& (left.fType == XSParticleDecl.PARTICLE_ELEMENT)) {
//
// Its a simple choice or sequence, so we can do a simple
// content model for it.
//
// pass both element decls
return new XSSimpleCM(type, (XSElementDecl)left.fValue, (XSElementDecl)right.fValue);
}
}
else if (type == XSParticleDecl.PARTICLE_ALL) {
XSParticleDecl left = (XSParticleDecl)particle.fValue;
XSParticleDecl right = (XSParticleDecl)particle.fOtherValue;
XSAllCM allContent = new XSAllCM(false);
gatherAllLeaves (left, allContent);
gatherAllLeaves (right, allContent);
return allContent;
}
else if ((type == XSParticleDecl.PARTICLE_ZERO_OR_ONE)
|| (type == XSParticleDecl.PARTICLE_ZERO_OR_MORE)
|| (type == XSParticleDecl.PARTICLE_ONE_OR_MORE)) {
//
// Its a repetition, so see if its one child is a leaf. If so
// its a repetition of a single element, so we can do a simple
// content model for that.
XSParticleDecl left = (XSParticleDecl) particle.fValue;
if (left.fType == XSParticleDecl.PARTICLE_ELEMENT) {
//
// It is, so we can create a simple content model here that
// will check for this repetition. We pass -1 for the unused