1 // -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
\r
3 // System.Xml.XmlAttribute
\r
6 // Daniel Weber (daniel-weber@austin.rr.com)
\r
8 // (C) 2001 Daniel Weberusing System;
\r
10 namespace System.Xml
\r
13 /// Summary description for XmlAttribute.
\r
15 public class XmlAttribute : XmlNode
\r
17 // ============ private data structures ==============================
\r
18 private XmlNode FOwner;
\r
19 private XmlNode FOwnerElement;
\r
21 string FelementName;
\r
25 //==== Public Properties ====================================================
\r
30 /// Saves all children of the current node to the passed writer
\r
32 /// <param name="w"></param>
\r
33 public override void WriteContentTo(XmlWriter w)
\r
35 // TODO - implement XmlAttribute.WriteContentsTo(XmlWriter)
\r
36 throw new NotImplementedException();
\r
40 /// Saves the current node to writer w
\r
42 /// <param name="w"></param>
\r
43 public override void WriteTo(XmlWriter w)
\r
45 // TODO - implement XmlAttribute.WriteTo(XmlWriter)
\r
46 throw new NotImplementedException();
\r
50 /// Returns the local name of the attribute. For attributes, this is the same as Name
\r
52 public override string LocalName
\r
61 /// Get the XmlNode representing the owning document
\r
63 public override XmlDocument OwnerDocument
\r
67 if (FOwner.NodeType == XmlNodeType.Document)
\r
68 return FOwner as XmlDocument;
\r
75 /// Retrieve the XmlElement owner of this attribute, or null if attribute not assigned
\r
77 public virtual XmlElement OwnerElement
\r
81 if (FOwnerElement.NodeType == XmlNodeType.Element)
\r
82 return FOwnerElement as XmlElement;
\r
88 /// Get the qualified attribute name. Attributes do not have an associated namespace.
\r
90 public override string Name
\r
98 //============== Public Methods =============================================
\r
100 /// Override. Returns the node type.
\r
102 public override XmlNodeType NodeType
\r
106 return XmlNodeType.Attribute;
\r
111 /// Return a clone of the node
\r
113 /// <param name="deep">Make copy of all children</param>
\r
114 /// <returns>Cloned node</returns>
\r
115 public override XmlNode CloneNode( bool deep)
\r
117 // TODO - implement XmlAttribute.CloneNode()
\r
118 throw new NotImplementedException();
\r
121 // ============ Internal methods ====================================
\r
122 internal void setOwnerElement( XmlElement newOwnerElement)
\r
124 FOwnerElement = newOwnerElement;
\r
127 // ============ Constructors =========================================
\r
128 public XmlAttribute()
\r
131 // TODO: Add constructor logic here
\r
135 internal XmlAttribute ( XmlNode aOwner, // owner document
\r
136 string elementName, // can be ""
\r
137 string attributeName, // cannot be ""
\r
140 string attValue) // attValue
\r
142 if (aOwner == null)
\r
143 throw new ArgumentException("Null OwnerDocument passed to XmlAttribute constructor");
\r
144 if (attributeName.Length == 0)
\r
145 throw new ArgumentException("Empty string passed to XmlAttribute constructor");
\r
148 FOwnerElement = null;
\r
149 FelementName = elementName;
\r
150 FattrName = attributeName;
\r
151 FattrValue = attValue;
\r