private SetParticle ( |
||
value | ||
return | void |
private XmlSchemaParticle CannonicalizeGroupRef(XmlSchemaGroupRef groupRef, bool root, bool substitution) { XmlSchemaGroup redefined; if (groupRef.Redefined != null) { redefined = groupRef.Redefined; } else { redefined = (XmlSchemaGroup) this.schema.Groups[groupRef.RefName]; } if (redefined == null) { base.SendValidationEvent("Sch_UndefGroupRef", groupRef.RefName.ToString(), groupRef); return XmlSchemaParticle.Empty; } if (redefined.CanonicalParticle == null) { this.CompileGroup(redefined); } if (redefined.CanonicalParticle == XmlSchemaParticle.Empty) { return XmlSchemaParticle.Empty; } XmlSchemaGroupBase canonicalParticle = (XmlSchemaGroupBase) redefined.CanonicalParticle; if (canonicalParticle is XmlSchemaAll) { if (!root) { base.SendValidationEvent("Sch_AllRefNotRoot", "", groupRef); return XmlSchemaParticle.Empty; } if ((groupRef.MinOccurs != 1M) || (groupRef.MaxOccurs != 1M)) { base.SendValidationEvent("Sch_AllRefMinMax", groupRef); return XmlSchemaParticle.Empty; } } else if ((canonicalParticle is XmlSchemaChoice) && (canonicalParticle.Items.Count == 0)) { if (groupRef.MinOccurs != 0M) { base.SendValidationEvent("Sch_EmptyChoice", groupRef, XmlSeverityType.Warning); } return XmlSchemaParticle.Empty; } XmlSchemaGroupBase base3 = (canonicalParticle is XmlSchemaSequence) ? ((XmlSchemaGroupBase) new XmlSchemaSequence()) : ((canonicalParticle is XmlSchemaChoice) ? ((XmlSchemaGroupBase) new XmlSchemaChoice()) : ((XmlSchemaGroupBase) new XmlSchemaAll())); base3.MinOccurs = groupRef.MinOccurs; base3.MaxOccurs = groupRef.MaxOccurs; for (int i = 0; i < canonicalParticle.Items.Count; i++) { base3.Items.Add((XmlSchemaParticle) canonicalParticle.Items[i]); } groupRef.SetParticle(base3); return base3; }
private XmlSchemaParticle CannonicalizeGroupRef(XmlSchemaGroupRef groupRef, bool root) { XmlSchemaGroup group; if (groupRef.Redefined != null) { group = groupRef.Redefined; } else { group = (XmlSchemaGroup)groups[groupRef.RefName]; } if (group == null) { SendValidationEvent(Res.Sch_UndefGroupRef, groupRef.RefName.ToString(), groupRef); return XmlSchemaParticle.Empty; } if (group.CanonicalParticle == null) { CompileGroup(group); } if (group.CanonicalParticle == XmlSchemaParticle.Empty) { return XmlSchemaParticle.Empty; } XmlSchemaGroupBase groupBase = (XmlSchemaGroupBase)group.CanonicalParticle; if (groupBase is XmlSchemaAll) { if (!root) { SendValidationEvent(Res.Sch_AllRefNotRoot, "", groupRef); return XmlSchemaParticle.Empty; } if (groupRef.MinOccurs > decimal.One || groupRef.MaxOccurs != decimal.One) { SendValidationEvent(Res.Sch_AllRefMinMax, groupRef); return XmlSchemaParticle.Empty; } } else if (groupBase is XmlSchemaChoice && groupBase.Items.Count == 0) { if (groupRef.MinOccurs != decimal.Zero) { SendValidationEvent(Res.Sch_EmptyChoice, groupRef, XmlSeverityType.Warning); } return XmlSchemaParticle.Empty; } XmlSchemaGroupBase groupRefBase = ( (groupBase is XmlSchemaSequence) ? (XmlSchemaGroupBase)new XmlSchemaSequence() : (groupBase is XmlSchemaChoice) ? (XmlSchemaGroupBase)new XmlSchemaChoice() : (XmlSchemaGroupBase)new XmlSchemaAll() ); groupRefBase.MinOccurs = groupRef.MinOccurs; groupRefBase.MaxOccurs = groupRef.MaxOccurs; CopyPosition(groupRefBase, groupRef, true); for (int i = 0; i < groupBase.Items.Count; ++i) { groupRefBase.Items.Add(groupBase.Items[i]); } groupRef.SetParticle(groupRefBase); return groupRefBase; }