2 // System.Xml.XmlAttribute
5 // Jason Diamond (jason@injektilo.org)
7 // (C) 2002 Jason Diamond http://injektilo.org/
14 public class XmlAttribute : XmlNode
18 private XmlLinkedNode lastChild;
19 private string localName;
20 private string namespaceURI;
21 private string prefix;
27 [MonoTODO("need to set namespaceURI if prefix is recognized built-in ones like xmlns")]
28 protected internal XmlAttribute (
32 XmlDocument doc) : base (doc)
35 this.localName = localName;
36 this.namespaceURI = namespaceURI;
43 public override string BaseURI {
45 return OwnerElement.BaseURI;
50 public override string InnerText {
52 throw new NotImplementedException ();
56 throw new NotImplementedException ();
60 [MonoTODO ("Setter.")]
61 public override string InnerXml {
63 // Not sure why this is an override. Passing through for now.
68 throw new NotImplementedException ();
72 public override string LocalName {
78 public override string Name {
80 return prefix != String.Empty ? prefix + ":" + localName : localName;
84 public override string NamespaceURI {
90 public override XmlNodeType NodeType {
92 return XmlNodeType.Attribute;
96 public override XmlDocument OwnerDocument {
98 return base.OwnerDocument;
102 public virtual XmlElement OwnerElement {
104 return base.ParentNode as XmlElement;
109 public override XmlNode ParentNode {
116 // We gotta do more in the set block here
117 // We need to do the proper tests and throw
118 // the correct Exceptions
119 public override string Prefix {
130 public virtual bool Specified {
132 throw new NotImplementedException ();
136 public override string Value {
138 XmlNode firstChild = FirstChild;
139 if (firstChild == null)
141 return firstChild.Value;
145 XmlNode firstChild = FirstChild;
146 if (firstChild == null)
147 AppendChild (OwnerDocument.CreateTextNode (value));
149 firstChild.Value = value;
157 public override XmlNode CloneNode (bool deep)
159 XmlNode node = new XmlAttribute (prefix, localName, namespaceURI,
162 while ((node != null) && (node.HasChildNodes)) {
163 AppendChild (node.NextSibling.CloneNode (true));
164 node = node.NextSibling;
171 public override void WriteContentTo (XmlWriter w)
173 w.WriteString (Value);
176 public override void WriteTo (XmlWriter w)
178 w.WriteAttributeString (prefix, localName, namespaceURI, Value);
183 internal override XmlLinkedNode LastLinkedChild {
184 get { return lastChild; }
186 set { lastChild = value; }