b98235f990ccb2b30b9bd0f4a10a072fca264592
[mono.git] / mcs / class / System.XML / System.Xml / XmlElement.cs
1 //
2 // System.Xml.XmlAttribute
3 //
4 // Author:
5 //   Jason Diamond (jason@injektilo.org)
6 //
7 // (C) 2002 Jason Diamond  http://injektilo.org/
8 //
9
10 using System;
11
12 namespace System.Xml
13 {
14         public class XmlElement : XmlLinkedNode
15         {
16                 #region Fields
17
18                 private XmlAttributeCollection attributes;
19                 private string localName;
20                 private string namespaceURI;
21                 private string prefix;
22
23                 #endregion
24
25                 #region Constructor
26
27                 protected internal XmlElement (
28                         string prefix, 
29                         string localName, 
30                         string namespaceURI, 
31                         XmlDocument doc) : base (doc)
32                 {
33                         this.prefix = prefix;
34                         this.localName = localName;
35                         this.namespaceURI = namespaceURI;
36
37                         attributes = new XmlAttributeCollection (this);
38                 }
39
40                 #endregion
41
42                 #region Properties
43
44                 public override XmlAttributeCollection Attributes {
45                         get { 
46                                 return attributes; 
47                         }
48                 }
49
50                 public virtual bool HasAttributes {
51                         get { 
52                                 return attributes.Count > 0; 
53                         }
54                 }
55
56                 [MonoTODO]
57                 public override string InnerText {
58                         get { 
59                                 throw new NotImplementedException (); 
60                         }
61
62                         set { 
63                                 throw new NotImplementedException (); 
64                         }
65                 }
66
67                 [MonoTODO]
68                 public override string InnerXml {
69                         get { 
70                                 throw new NotImplementedException (); 
71                         }
72
73                         set { 
74                                 throw new NotImplementedException (); 
75                         }
76                 }
77
78                 [MonoTODO]
79                 public bool IsEmpty     {
80                         get { 
81                                 throw new NotImplementedException (); 
82                         }
83
84                         set { 
85                                 throw new NotImplementedException (); 
86                         }
87                 }
88
89                 public override string LocalName {
90                         get { 
91                                 return localName; 
92                         }
93                 }
94
95                 public override string Name {
96                         get { 
97                                 return prefix != String.Empty ? prefix + ":" + localName : localName; 
98                         }
99                 }
100
101                 public override string NamespaceURI {
102                         get { 
103                                 return namespaceURI; 
104                         }
105                 }
106
107                 [MonoTODO]
108                 public override XmlNode NextSibling {
109                         get { 
110                                 return base.NextSibling; 
111                         }
112                 }
113
114                 public override XmlNodeType NodeType {
115                         get { 
116                                 return XmlNodeType.Element; 
117                         }
118                 }
119
120                 [MonoTODO]
121                 public override XmlDocument OwnerDocument {
122                         get { 
123                                 return base.OwnerDocument; 
124                         }
125                 }
126
127                 public override string Prefix {
128                         get { 
129                                 return prefix; 
130                         }
131                 }
132
133                 #endregion
134
135                 #region Methods
136
137                 [MonoTODO]
138                 public override XmlNode CloneNode (bool deep)
139                 {
140                         throw new NotImplementedException ();
141                 }
142
143                 [MonoTODO]
144                 public virtual string GetAttribute (string name)
145                 {
146                         XmlNode attributeNode = Attributes.GetNamedItem (name);
147                         return attributeNode != null ? attributeNode.Value : String.Empty;
148                 }
149
150                 [MonoTODO]
151                 public virtual string GetAttribute (string localName, string namespaceURI)
152                 {
153                         throw new NotImplementedException ();
154                 }
155
156                 [MonoTODO]
157                 public virtual XmlAttribute GetAttributeNode (string name)
158                 {
159                         throw new NotImplementedException ();
160                 }
161
162                 [MonoTODO]
163                 public virtual XmlAttribute GetAttributeNode (string localName, string namespaceURI)
164                 {
165                         throw new NotImplementedException ();
166                 }
167
168                 [MonoTODO]
169                 public virtual XmlNodeList GetElementsByTagName (string name)
170                 {
171                         throw new NotImplementedException ();
172                 }
173
174                 [MonoTODO]
175                 public virtual XmlNodeList GetElementsByTagName (string localName, string namespaceURI)
176                 {
177                         throw new NotImplementedException ();
178                 }
179
180                 [MonoTODO]
181                 public virtual bool HasAttribute (string name)
182                 {
183                         throw new NotImplementedException ();
184                 }
185
186                 [MonoTODO]
187                 public virtual bool HasAttribute (string localName, string namespaceURI)
188                 {
189                         throw new NotImplementedException ();
190                 }
191
192                 [MonoTODO ("Don't remove default attributes.")]
193                 public override void RemoveAll ()
194                 {
195                         // Remove the child nodes.
196                         base.RemoveAll ();
197
198                         // Remove all attributes.
199                         attributes.RemoveAll ();
200                 }
201
202                 [MonoTODO]
203                 public virtual void RemoveAllAttributes ()
204                 {
205                         throw new NotImplementedException ();
206                 }
207
208                 [MonoTODO]
209                 public virtual void RemoveAttribute (string name)
210                 {
211                         throw new NotImplementedException ();
212                 }
213
214                 [MonoTODO]
215                 public virtual void RemoveAttribute (string localName, string namespaceURI)
216                 {
217                         throw new NotImplementedException ();
218                 }
219
220                 [MonoTODO]
221                 public virtual XmlNode RemoveAttributeAt (int i)
222                 {
223                         throw new NotImplementedException ();
224                 }
225
226                 [MonoTODO]
227                 public virtual XmlAttribute RemoveAttributeNode (XmlAttribute oldAttr)
228                 {
229                         throw new NotImplementedException ();
230                 }
231
232                 [MonoTODO]
233                 public virtual XmlAttribute RemoveAttributeNode (string localName, string namespaceURI)
234                 {
235                         throw new NotImplementedException ();
236                 }
237
238                 [MonoTODO]
239                 public virtual void SetAttribute (string name, string value)
240                 {
241                         XmlAttribute attribute = OwnerDocument.CreateAttribute (name);
242                         attribute.SetOwnerElement (this);
243                         attribute.Value = value;
244                         Attributes.SetNamedItem (attribute);
245                 }
246
247                 [MonoTODO]
248                 public virtual void SetAttribute (string localName, string namespaceURI, string value)
249                 {
250                         throw new NotImplementedException ();
251                 }
252
253                 [MonoTODO]
254                 public virtual XmlAttribute SetAttributeNode (XmlAttribute newAttr)
255                 {
256                         throw new NotImplementedException ();
257                 }
258
259                 [MonoTODO]
260                 public virtual XmlAttribute SetAttributeNode (string localName, string namespaceURI)
261                 {
262                         throw new NotImplementedException ();
263                 }
264
265                 [MonoTODO]
266                 public override void WriteContentTo (XmlWriter w)
267                 {
268                         throw new NotImplementedException ();
269                 }
270
271                 [MonoTODO]
272                 public override void WriteTo (XmlWriter w)
273                 {
274                         throw new NotImplementedException ();
275                 }
276
277                 #endregion
278         }
279 }