Fixed typo in XmlDocument.Load that was duplicating the LocalName in the Prefix.
[mono.git] / mcs / class / System.XML / System.Xml / XmlAttribute.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 XmlAttribute : XmlNode
15         {
16                 #region Fields
17
18                 private XmlElement ownerElement;
19                 private XmlLinkedNode lastChild;
20                 private string localName;
21                 private string namespaceURI;
22                 private string prefix;
23
24                 #endregion
25
26                 #region Constructor
27
28                 protected internal XmlAttribute (
29                         string prefix, 
30                         string localName, 
31                         string namespaceURI, 
32                         XmlDocument doc) : base (doc)
33                 {
34                         this.prefix = prefix;
35                         this.localName = localName;
36                         this.namespaceURI = namespaceURI;
37                 }
38
39                 #endregion
40
41                 #region Properties
42
43                 [MonoTODO]
44                 public override string BaseURI {
45                         get {
46                                 throw new NotImplementedException ();
47                         }
48                 }
49
50                 [MonoTODO]
51                 public override string InnerText {
52                         get {
53                                 throw new NotImplementedException ();
54                         }
55
56                         set {
57                                 throw new NotImplementedException ();
58                         }
59                 }
60
61                 [MonoTODO]
62                 public override string InnerXml {
63                         get {
64                                 throw new NotImplementedException ();
65                         }
66
67                         set {
68                                 throw new NotImplementedException ();
69                         }
70                 }
71
72                 public override string LocalName {
73                         get {
74                                 return localName;
75                         }
76                 }
77
78                 public override string Name {
79                         get { 
80                                 return prefix != String.Empty ? prefix + ":" + localName : localName; 
81                         }
82                 }
83
84                 public override string NamespaceURI {
85                         get {
86                                 return namespaceURI;
87                         }
88                 }
89
90                 public override XmlNodeType NodeType {
91                         get {
92                                 return XmlNodeType.Attribute;
93                         }
94                 }
95
96                 public override XmlDocument OwnerDocument {
97                         get {
98                                 return base.OwnerDocument;
99                         }
100                 }
101
102                 public virtual XmlElement OwnerElement {
103                         get {
104                                 return ownerElement;
105                         }
106                 }
107
108                 [MonoTODO]
109                 public override XmlNode ParentNode {
110                         get {
111                                 return null;
112                         }
113                 }
114
115                 public override string Prefix {
116                         get {
117                                 return prefix;
118                         }
119                 }
120
121                 [MonoTODO]
122                 public virtual bool Specified {
123                         get {
124                                 throw new NotImplementedException ();
125                         }
126                 }
127
128                 public override string Value {
129                         get {
130                                 XmlNode firstChild = FirstChild;
131                                 if (firstChild == null)
132                                         return String.Empty;
133                                 return firstChild.Value;
134                         }
135
136                         set {
137                                 XmlNode firstChild = FirstChild;
138                                 if (firstChild == null)
139                                         AppendChild (OwnerDocument.CreateTextNode (value));
140                                 else
141                                         firstChild.Value = value;
142                         }
143                 }
144
145                 #endregion
146
147                 #region Methods
148
149                 [MonoTODO]
150                 public override XmlNode CloneNode (bool deep)
151                 {
152                         throw new NotImplementedException ();
153                 }
154
155                 internal void SetOwnerElement (XmlElement ownerElement)
156                 {
157                         this.ownerElement = ownerElement;
158                 }
159
160                 [MonoTODO]
161                 public override void WriteContentTo(XmlWriter w)
162                 {
163                         throw new NotImplementedException ();
164                 }
165
166                 [MonoTODO]
167                 public override void WriteTo(XmlWriter w)
168                 {
169                         throw new NotImplementedException ();
170                 }
171
172                 #endregion
173
174                 internal override XmlLinkedNode LastLinkedChild {
175                         get     {
176                                 return lastChild;
177                         }
178
179                         set {
180                                 lastChild = value;
181                         }
182                 }
183         }
184 }