* particleToDefs
*/
private boolean particleToDefs(XSParticle particle, List propDefList, List nodeDefList) throws SchemaConversionException {
boolean orderable = false;
XSTerm term = particle.getTerm();
// If the maxoccurs setting of this particle is zero then this
// particle does not contribute any node or property definition and
// we do nothing and return.
if (particle.getMaxOccurs() == 0) {
return orderable;
}
// Determine the mandatory setting of the node or property
// corresponding to this particle (if this particle does not
// correspond to node or property this information is ignored).
boolean mandatory = false;
if (particle.getMinOccurs() > 0) {
mandatory = true;
}
// Determine the same-name siblings setting of the node, or
// the multiple setting of the property, corresponding to this
// particle (if this particle does not correspond to
// node or property this information is ignored).
boolean multiple = false;
if (particle.getMaxOccurs() > 1 || particle.getMaxOccursUnbounded()) {
multiple = true;
}
// If this particle is an element declaration (an <xs:element>)
// then it is converted into either a node or property def.
if (term.getType() == XSConstants.ELEMENT_DECLARATION) {
XSElementDeclaration eDec = (XSElementDeclaration) term;
// Name for property or node def taken from the name of the element
QName name = new QName(noNull(eDec.getNamespace()), eDec.getName());
// Get the type definition for this element declaration
XSTypeDefinition tDef = eDec.getTypeDefinition();
// If this element declaration is of simple type
// then it is converted into a property def
if (tDef.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
XSSimpleTypeDefinition stDef = (XSSimpleTypeDefinition) tDef;
PropDef propDef = simpleTypeToPropDef(stDef, name, mandatory, multiple);
propDefList.add(propDef);
// If this element declaration is of complex type then
// it is converted into either node or property def
} else if (tDef.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
XSComplexTypeDefinition ctDef = (XSComplexTypeDefinition) tDef;
// If the complex type definition contains a simple content model
// and does not contain any attribute uses or attribute wildcards
// then the enclosing element is converted to a property def
if (ctDef.getContentType() == XSComplexTypeDefinition.CONTENTTYPE_SIMPLE && ctDef.getAttributeUses().getLength() == 0 && ctDef.getAttributeWildcard() == null) {
XSSimpleTypeDefinition std = ctDef.getSimpleType();
PropDef pd = simpleTypeToPropDef(std, name, mandatory, multiple);
propDefList.add(pd);
// If the complex type definition contains a complex content model
// or a simple content model with attribute uses or an attribute wildcard
// then the enclosing element is converted into a node def
} else {
NodeDef nd = complexTypeToNodeDef(ctDef, name, mandatory, multiple);
nodeDefList.add(nd);
}
}
// If this particle is a wildcard (an <xs:any> )then it
// is converted into a node def.
} else if (term.getType() == XSConstants.WILDCARD) {
nodeDefList.add(wildcardNodeDef());
// If this particle is a model group (one of
// <xs:sequence>, <xs:choice> or <xs:all>) then
// it subparticles must be processed.
} else if (term.getType() == XSConstants.MODEL_GROUP) {
XSModelGroup mg = (XSModelGroup) term;
/* Si cela est une séquence */
// If the top level compositor is <xs:sequence> we convert this to
// mean that the node type corresponding to the complex type def will have