1 // Author: Dwivedi, Ajay kumar
\r
4 using System.Xml.Serialization;
\r
6 namespace System.Xml.Schema
\r
9 /// Summary description for XmlSchemaGroupBase.
\r
11 public abstract class XmlSchemaGroupBase : XmlSchemaParticle
\r
13 private XmlSchemaObjectCollection compiledItems;
\r
15 protected XmlSchemaGroupBase()
\r
17 compiledItems = new XmlSchemaObjectCollection ();
\r
21 public abstract XmlSchemaObjectCollection Items { get; }
\r
23 internal XmlSchemaObjectCollection CompiledItems
\r
25 get{ return compiledItems; }
\r
28 internal override bool ParticleEquals (XmlSchemaParticle other)
\r
30 XmlSchemaChoice choice = other as XmlSchemaChoice;
\r
33 if (this.ValidatedMaxOccurs != choice.ValidatedMaxOccurs ||
\r
34 this.ValidatedMinOccurs != choice.ValidatedMinOccurs)
\r
36 if (this.CompiledItems.Count != choice.CompiledItems.Count)
\r
38 for (int i = 0; i < CompiledItems.Count; i++) {
\r
39 XmlSchemaParticle p1 = this.CompiledItems [i] as XmlSchemaParticle;
\r
40 XmlSchemaParticle p2 = choice.CompiledItems [i] as XmlSchemaParticle;
\r
41 if (!p1.ParticleEquals (p2))
\r
47 internal void ValidateNSRecurseCheckCardinality (XmlSchemaAny any,
\r
48 ValidationEventHandler h, XmlSchema schema)
\r
50 foreach (XmlSchemaParticle p in Items)
\r
51 p.ValidateDerivationByRestriction (any, h, schema);
\r
52 ValidateOccurenceRangeOK (any, h, schema);
\r
55 internal void ValidateRecurse (XmlSchemaGroupBase baseGroup,
\r
56 ValidationEventHandler h, XmlSchema schema)
\r
59 for (int i = 0; i < baseGroup.CompiledItems.Count; i++) {
\r
60 XmlSchemaParticle pb = baseGroup.CompiledItems [i] as XmlSchemaParticle;
\r
61 if (pb.ActualParticle == XmlSchemaParticle.Empty)
\r
63 XmlSchemaParticle pd = null;
\r
64 while (this.CompiledItems.Count > index) {
\r
65 pd = this.CompiledItems [index] as XmlSchemaParticle;
\r
67 if (pd.ActualParticle != XmlSchemaParticle.Empty)
\r
72 pd.ActualParticle.ValidateDerivationByRestriction (pb.ActualParticle, h, schema);
\r
73 } catch (XmlSchemaException ex) {
\r
74 if (!pb.ValidateIsEmptiable ())
\r
75 error (h, "Invalid particle derivation by restriction was found. Invalid sub-particle derivation was found.", ex);
\r
77 index--; // try the same derived particle and next base particle.
\r
79 } else if (!pb.ValidateIsEmptiable ()) {
\r
80 error (h, "Invalid particle derivation by restriction was found. Base schema particle has non-emptiable sub particle that is not mapped to the derived particle.");
\r
84 if (index != this.CompiledItems.Count)
\r
85 error (h, "Invalid particle derivation by restriction was found. Extraneous derived particle was found.");
\r