XmlSchemaGroupBase.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Author: Dwivedi, Ajay kumar
  2. // [email protected]
  3. using System;
  4. using System.Xml.Serialization;
  5. namespace System.Xml.Schema
  6. {
  7. /// <summary>
  8. /// Summary description for XmlSchemaGroupBase.
  9. /// </summary>
  10. public abstract class XmlSchemaGroupBase : XmlSchemaParticle
  11. {
  12. private XmlSchemaObjectCollection compiledItems;
  13. protected XmlSchemaGroupBase()
  14. {
  15. compiledItems = new XmlSchemaObjectCollection ();
  16. }
  17. [XmlIgnore]
  18. public abstract XmlSchemaObjectCollection Items { get; }
  19. internal XmlSchemaObjectCollection CompiledItems
  20. {
  21. get{ return compiledItems; }
  22. }
  23. internal override bool ParticleEquals (XmlSchemaParticle other)
  24. {
  25. XmlSchemaChoice choice = other as XmlSchemaChoice;
  26. if (choice == null)
  27. return false;
  28. if (this.ValidatedMaxOccurs != choice.ValidatedMaxOccurs ||
  29. this.ValidatedMinOccurs != choice.ValidatedMinOccurs)
  30. return false;
  31. if (this.CompiledItems.Count != choice.CompiledItems.Count)
  32. return false;
  33. for (int i = 0; i < CompiledItems.Count; i++) {
  34. XmlSchemaParticle p1 = this.CompiledItems [i] as XmlSchemaParticle;
  35. XmlSchemaParticle p2 = choice.CompiledItems [i] as XmlSchemaParticle;
  36. if (!p1.ParticleEquals (p2))
  37. return false;
  38. }
  39. return true;
  40. }
  41. internal void ValidateNSRecurseCheckCardinality (XmlSchemaAny any,
  42. ValidationEventHandler h, XmlSchema schema)
  43. {
  44. foreach (XmlSchemaParticle p in Items)
  45. p.ValidateDerivationByRestriction (any, h, schema);
  46. ValidateOccurenceRangeOK (any, h, schema);
  47. }
  48. }
  49. }