private XmlSchemaParticle CannonicalizeAll(XmlSchemaAll all, bool root) {
if (all.Items.Count > 0) {
XmlSchemaAll newAll = new XmlSchemaAll();
newAll.MinOccurs = all.MinOccurs;
newAll.MaxOccurs = all.MaxOccurs;
CopyPosition(newAll, all, true);
foreach (XmlSchemaElement e in all.Items) {
XmlSchemaParticle p = CannonicalizeParticle(e, false);
if (p != XmlSchemaParticle.Empty) {
newAll.Items.Add(p);
}
}
all = newAll;
}
if (all.Items.Count == 0) {
return XmlSchemaParticle.Empty;
}
else if (!root) {
SendValidationEvent(Res.Sch_NotAllAlone, all);
return XmlSchemaParticle.Empty;
}
else {
return all;
}
}