private void CompileSubstitutionGroup(XmlSchemaSubstitutionGroupV1Compat substitutionGroup) {
if (substitutionGroup.IsProcessing) {
foreach (XmlSchemaElement element in substitutionGroup.Members) {
SendValidationEvent(Res.Sch_SubstitutionCircularRef, element);
return;
}
}
XmlSchemaElement examplar = (XmlSchemaElement)this.schema.Elements[substitutionGroup.Examplar];
if (substitutionGroup.Members.Contains(examplar)) {// already checked
return;
}
substitutionGroup.IsProcessing = true;
if (examplar != null) {
if (examplar.FinalResolved == XmlSchemaDerivationMethod.All) {
SendValidationEvent(Res.Sch_InvalidExamplar, examplar);
}
foreach (XmlSchemaElement element in substitutionGroup.Members) {
//Chain to other head's that are members of this head's substGroup
XmlSchemaSubstitutionGroupV1Compat g = (XmlSchemaSubstitutionGroupV1Compat)examplars[element.QualifiedName];
if (g != null) {
CompileSubstitutionGroup(g);
foreach (XmlSchemaElement element1 in g.Choice.Items) {
substitutionGroup.Choice.Items.Add(element1);
}
}
else {
substitutionGroup.Choice.Items.Add(element);
}
}
substitutionGroup.Choice.Items.Add(examplar);
substitutionGroup.Members.Add(examplar); // Compiled mark
}
else {
foreach (XmlSchemaElement element in substitutionGroup.Members) {
SendValidationEvent(Res.Sch_NoExamplar, element);
break;
}
}
substitutionGroup.IsProcessing = false;
}