private bool IsElementFromGroupBase(XmlSchemaElement derivedElement, XmlSchemaGroupBase baseGroupBase) {
if (baseGroupBase is XmlSchemaSequence) {
XmlSchemaSequence virtualSeq = new XmlSchemaSequence();
virtualSeq.MinOccurs = 1;
virtualSeq.MaxOccurs = 1;
virtualSeq.Items.Add(derivedElement);
if (IsGroupBaseFromGroupBase((XmlSchemaGroupBase)virtualSeq, baseGroupBase, true)) {
return true;
}
restrictionErrorMsg = Res.GetString(Res.Sch_ElementFromGroupBase1, derivedElement.QualifiedName.ToString(), derivedElement.LineNumber.ToString(NumberFormatInfo.InvariantInfo), derivedElement.LinePosition.ToString(NumberFormatInfo.InvariantInfo), baseGroupBase.LineNumber.ToString(NumberFormatInfo.InvariantInfo), baseGroupBase.LinePosition.ToString(NumberFormatInfo.InvariantInfo));
}
else if (baseGroupBase is XmlSchemaChoice) {
XmlSchemaChoice virtualChoice = new XmlSchemaChoice();
virtualChoice.MinOccurs = 1;
virtualChoice.MaxOccurs = 1;
virtualChoice.Items.Add(derivedElement);
if (IsGroupBaseFromGroupBase((XmlSchemaGroupBase)virtualChoice, baseGroupBase, false)) {
return true;
}
restrictionErrorMsg = Res.GetString(Res.Sch_ElementFromGroupBase2, derivedElement.QualifiedName.ToString(), derivedElement.LineNumber.ToString(NumberFormatInfo.InvariantInfo), derivedElement.LinePosition.ToString(NumberFormatInfo.InvariantInfo), baseGroupBase.LineNumber.ToString(NumberFormatInfo.InvariantInfo), baseGroupBase.LinePosition.ToString(NumberFormatInfo.InvariantInfo));
}
else if (baseGroupBase is XmlSchemaAll) {
XmlSchemaAll virtualAll = new XmlSchemaAll();
virtualAll.MinOccurs = 1;
virtualAll.MaxOccurs = 1;
virtualAll.Items.Add(derivedElement);
if (IsGroupBaseFromGroupBase((XmlSchemaGroupBase)virtualAll, baseGroupBase, true)) {
return true;
}
restrictionErrorMsg = Res.GetString(Res.Sch_ElementFromGroupBase3, derivedElement.QualifiedName.ToString(), derivedElement.LineNumber.ToString(NumberFormatInfo.InvariantInfo), derivedElement.LinePosition.ToString(NumberFormatInfo.InvariantInfo), baseGroupBase.LineNumber.ToString(NumberFormatInfo.InvariantInfo), baseGroupBase.LinePosition.ToString(NumberFormatInfo.InvariantInfo));
}
return false;
}