XmlSchemaCollection.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. // Author: Dwivedi, Ajay kumar
  2. // [email protected]
  3. using System;
  4. using System.Collections;
  5. using System.Xml;
  6. namespace System.Xml.Schema
  7. {
  8. /// <summary>
  9. /// Summary description for XmlSchemaCollection.
  10. /// </summary>
  11. public sealed class XmlSchemaCollection : ICollection, IEnumerable
  12. {
  13. //private fields
  14. private Hashtable htable;
  15. private Hashtable uriTable;
  16. private XmlNameTable ntable;
  17. public XmlSchemaCollection()
  18. : this (new NameTable ())
  19. {
  20. }
  21. public XmlSchemaCollection(XmlNameTable nametable)
  22. {
  23. htable = new Hashtable();
  24. uriTable = new Hashtable ();
  25. ntable = nametable;
  26. }
  27. //properties
  28. public int Count
  29. {
  30. get
  31. {
  32. return this.htable.Count;
  33. }
  34. }
  35. public XmlNameTable NameTable
  36. {
  37. get
  38. {
  39. return this.ntable;
  40. }
  41. }
  42. public XmlSchema this[ string ns ]
  43. {
  44. get
  45. {
  46. return (XmlSchema) this.htable[ns];
  47. }
  48. }
  49. // Events
  50. public event ValidationEventHandler ValidationEventHandler;
  51. // Methods
  52. [MonoTODO]
  53. public XmlSchema Add(string ns, XmlReader reader)
  54. {
  55. if (reader == null)
  56. throw new ArgumentNullException ("reader");
  57. throw new NotImplementedException ();
  58. }
  59. [MonoTODO]
  60. public XmlSchema Add(string ns, string uri)
  61. {
  62. if (uri == null || uri == String.Empty)
  63. throw new ArgumentNullException ("uri");
  64. throw new NotImplementedException ();
  65. }
  66. [MonoTODO]
  67. public XmlSchema Add(XmlSchema schema)
  68. {
  69. if (schema == null)
  70. throw new ArgumentNullException ("schema");
  71. throw new NotImplementedException ();
  72. }
  73. public void Add(XmlSchemaCollection schema)
  74. {
  75. if (schema == null)
  76. throw new ArgumentNullException ("schema");
  77. foreach (XmlSchema s in schema)
  78. Add (s);
  79. }
  80. public bool Contains(string ns)
  81. {
  82. return this.htable.Contains(ns);
  83. }
  84. public bool Contains(XmlSchema schema)
  85. {
  86. return this.htable.Contains(schema.TargetNamespace);
  87. }
  88. public void CopyTo(XmlSchema[] array, int index)
  89. {
  90. }
  91. public XmlSchemaCollectionEnumerator GetEnumerator()
  92. {
  93. return new XmlSchemaCollectionEnumerator(this.htable);
  94. }
  95. //assembly Methods
  96. [MonoTODO]
  97. void ICollection.CopyTo(Array array, int index)
  98. {
  99. }
  100. bool ICollection.IsSynchronized
  101. {
  102. get { return false; }
  103. }
  104. IEnumerator IEnumerable.GetEnumerator()
  105. {
  106. return this.htable.GetEnumerator();
  107. }
  108. Object ICollection.SyncRoot
  109. {
  110. get { return this; }
  111. }
  112. }
  113. }