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