private CMNode buildSyntaxTree(XSParticleDecl particle) {
int maxOccurs = particle.fMaxOccurs;
int minOccurs = particle.fMinOccurs;
short type = particle.fType;
CMNode nodeRet = null;
if ((type == XSParticleDecl.PARTICLE_WILDCARD) ||
(type == XSParticleDecl.PARTICLE_ELEMENT)) {
// (task 1) element and wildcard particles should be converted to
// leaf nodes
// REVISIT: Make a clone of the leaf particle, so that if there
// are two references to the same group, we have two different
// leaf particles for the same element or wildcard decl.
// This is useful for checking UPA.
nodeRet = fNodeFactory.getCMLeafNode(particle.fType, particle.fValue, fParticleCount++, fLeafCount++);
// (task 2) expand occurrence values
nodeRet = expandContentModel(nodeRet, minOccurs, maxOccurs);
}
else if (type == XSParticleDecl.PARTICLE_MODELGROUP) {
// (task 1,3) convert model groups to binary trees
XSModelGroupImpl group = (XSModelGroupImpl)particle.fValue;
CMNode temp = null;
// when the model group is a choice of more than one particles, but
// only one of the particle is not empty, (for example
// <choice>
// <sequence/>
// <element name="e"/>