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 XmlElement ownerElement;
19 private XmlLinkedNode lastChild;
20 private string localName;
21 private string namespaceURI;
22 private string prefix;
28 [MonoTODO("need to set namespaceURI if prefix is recognized built-in ones like xmlns")]
29 protected internal XmlAttribute (
33 XmlDocument doc) : base (doc)
36 this.localName = localName;
37 this.namespaceURI = namespaceURI;
45 public override string BaseURI {
47 throw new NotImplementedException ();
52 public override string InnerText {
54 throw new NotImplementedException ();
58 throw new NotImplementedException ();
62 [MonoTODO ("Setter.")]
63 public override string InnerXml {
65 // Not sure why this is an override. Passing through for now.
70 throw new NotImplementedException ();
74 public override string LocalName {
80 public override string Name {
82 return prefix != String.Empty ? prefix + ":" + localName : localName;
86 public override string NamespaceURI {
92 public override XmlNodeType NodeType {
94 return XmlNodeType.Attribute;
98 public override XmlDocument OwnerDocument {
100 return base.OwnerDocument;
104 public virtual XmlElement OwnerElement {
111 public override XmlNode ParentNode {
118 // We gotta do more in the set block here
119 // We need to do the proper tests and throw
120 // the correct Exceptions
121 public override string Prefix {
132 public virtual bool Specified {
134 throw new NotImplementedException ();
138 public override string Value {
140 XmlNode firstChild = FirstChild;
141 if (firstChild == null)
143 return firstChild.Value;
147 XmlNode firstChild = FirstChild;
148 if (firstChild == null)
149 AppendChild (OwnerDocument.CreateTextNode (value));
151 firstChild.Value = value;
159 public override XmlNode CloneNode (bool deep)
161 XmlNode node = new XmlAttribute (prefix, localName, namespaceURI,
164 while ((node != null) && (node.HasChildNodes)) {
165 AppendChild (node.NextSibling.CloneNode (true));
166 node = node.NextSibling;
173 internal void SetOwnerElement (XmlElement ownerElement)
175 this.ownerElement = ownerElement;
178 public override void WriteContentTo (XmlWriter w)
180 w.WriteString (Value);
183 public override void WriteTo (XmlWriter w)
185 w.WriteAttributeString (prefix, localName, namespaceURI, Value);
190 internal override XmlLinkedNode LastLinkedChild {
191 get { return lastChild; }
193 set { lastChild = value; }