2002-08-16 Jason Diamond <jason@injektilo.org>
[mono.git] / mcs / class / System.XML / System.Xml / XmlReader.cs
1 //
2 // XmlReader.cs
3 //
4 // Author:
5 //   Jason Diamond (jason@injektilo.org)
6 //
7 // (C) 2001, 2002 Jason Diamond  http://injektilo.org/
8 //
9
10 namespace System.Xml
11 {
12         public abstract class XmlReader
13         {
14                 #region Constructor
15
16                 protected XmlReader ()
17                 {
18                 }
19
20                 #endregion
21
22                 #region Properties
23
24                 public abstract int AttributeCount { get; }
25
26                 public abstract string BaseURI { get; }
27
28                 public virtual bool CanResolveEntity
29                 {
30                         get     { return false; }
31                 }
32
33                 public abstract int Depth { get; }
34
35                 public abstract bool EOF { get; }
36
37                 public virtual bool HasAttributes
38                 {
39                         get { return AttributeCount > 0; }
40                 }
41
42                 public abstract bool HasValue { get; }
43
44                 public abstract bool IsDefault { get; }
45
46                 public abstract bool IsEmptyElement { get; }
47
48                 public abstract string this[int i] { get; }
49
50                 public abstract string this[string name] { get; }
51
52                 public abstract string this[
53                         string localName,
54                         string namespaceName]
55                 { get; }
56
57                 public abstract string LocalName { get; }
58
59                 public abstract string Name { get; }
60
61                 public abstract string NamespaceURI { get; }
62
63                 public abstract XmlNameTable NameTable { get; }
64
65                 public abstract XmlNodeType NodeType { get; }
66
67                 public abstract string Prefix { get; }
68
69                 public abstract char QuoteChar { get; }
70
71                 public abstract ReadState ReadState { get; }
72
73                 public abstract string Value { get; }
74
75                 public abstract string XmlLang { get; }
76
77                 public abstract XmlSpace XmlSpace { get; }
78
79                 #endregion
80
81                 #region Methods
82
83                 public abstract void Close ();
84
85                 public abstract string GetAttribute (int i);
86
87                 public abstract string GetAttribute (string name);
88
89                 public abstract string GetAttribute (
90                         string localName,
91                         string namespaceName);
92
93                 public static bool IsName (string s)
94                 {
95                         bool result = false;
96
97                         if (s != null && s.Length > 0) {
98                                 char[] chars = s.ToCharArray ();
99
100                                 if (XmlChar.IsFirstNameChar (chars[0])) {
101                                         int i = 1;
102                                         int n = chars.Length;
103
104                                         while (i < n && XmlChar.IsNameChar (chars[i]))
105                                                 ++i;
106
107                                         result = i == n;
108                                 }
109                         }
110
111                         return result;
112                 }
113
114                 public static bool IsNameToken (string s)
115                 {
116                         bool result = false;
117
118                         if (s != null && s.Length > 0) {
119                                 char[] chars = s.ToCharArray ();
120
121                                 int i = 0;
122                                 int n = chars.Length;
123
124                                 while (i < n && XmlChar.IsNameChar (chars[i]))
125                                         ++i;
126
127                                 result = i == n;
128                         }
129
130                         return result;
131                 }
132
133                 [MonoTODO]
134                 public virtual bool IsStartElement ()
135                 {
136                         throw new NotImplementedException ();
137                 }
138
139                 [MonoTODO]
140                 public virtual bool IsStartElement (string name)
141                 {
142                         throw new NotImplementedException ();
143                 }
144
145                 [MonoTODO]
146                 public virtual bool IsStartElement (
147                         string localName,
148                         string namespaceName)
149                 {
150                         throw new NotImplementedException ();
151                 }
152
153                 public abstract string LookupNamespace (string prefix);
154
155                 public abstract void MoveToAttribute (int i);
156
157                 public abstract bool MoveToAttribute (string name);
158
159                 public abstract bool MoveToAttribute (
160                         string localName,
161                         string namespaceName);
162
163                 [MonoTODO]
164                 public virtual XmlNodeType MoveToContent ()
165                 {
166                         throw new NotImplementedException ();
167                 }
168
169                 public abstract bool MoveToElement ();
170
171                 public abstract bool MoveToFirstAttribute ();
172
173                 public abstract bool MoveToNextAttribute ();
174
175                 public abstract bool Read ();
176
177                 public abstract bool ReadAttributeValue ();
178
179                 [MonoTODO]
180                 public virtual string ReadElementString ()
181                 {
182                         throw new NotImplementedException ();
183                 }
184
185                 [MonoTODO]
186                 public virtual string ReadElementString (string name)
187                 {
188                         throw new NotImplementedException ();
189                 }
190
191                 [MonoTODO]
192                 public virtual string ReadElementString (
193                         string localName,
194                         string namespaceName)
195                 {
196                         throw new NotImplementedException ();
197                 }
198
199                 [MonoTODO]
200                 public virtual void ReadEndElement ()
201                 {
202                         throw new NotImplementedException ();
203                 }
204
205                 public abstract string ReadInnerXml ();
206
207                 public abstract string ReadOuterXml ();
208
209                 [MonoTODO]
210                 public virtual void ReadStartElement ()
211                 {
212                         throw new NotImplementedException ();
213                 }
214
215                 [MonoTODO]
216                 public virtual void ReadStartElement (string name)
217                 {
218                         throw new NotImplementedException ();
219                 }
220
221                 [MonoTODO]
222                 public virtual void ReadStartElement (
223                         string localName,
224                         string namespaceName)
225                 {
226                         throw new NotImplementedException ();
227                 }
228
229                 public abstract string ReadString ();
230
231                 public abstract void ResolveEntity ();
232
233                 [MonoTODO]
234                 public virtual void Skip ()
235                 {
236                         throw new NotImplementedException ();
237                 }
238
239                 #endregion
240         }
241 }