private XmlSchemaParticle CannonicalizeElement(XmlSchemaElement element) {
if (!element.RefName.IsEmpty && (element.ElementDecl.Block & XmlSchemaDerivationMethod.Substitution) == 0) {
XmlSchemaSubstitutionGroup substitutionGroup = (XmlSchemaSubstitutionGroup)examplars[element.QualifiedName];
if (substitutionGroup == null) {
return element;
}
else {
XmlSchemaChoice choice = new XmlSchemaChoice();
foreach(XmlSchemaElement elem in substitutionGroup.Members) {
choice.Items.Add(elem);
}
choice.MinOccurs = element.MinOccurs;
choice.MaxOccurs = element.MaxOccurs;
CopyPosition(choice, element, false);
return choice;
}
}
else {
return element;
}
}