5 // Kral Ferch <kral_ferch@hotmail.com>
11 using System.Collections;
12 using System.Xml.XPath;
16 public abstract class XmlNode : ICloneable, IEnumerable, IXPathNavigable
20 XmlDocument ownerDocument;
27 protected internal XmlNode(XmlDocument ownerDocument)
29 this.ownerDocument = ownerDocument;
36 public virtual XmlAttributeCollection Attributes
42 public virtual string BaseURI
44 get { throw new NotImplementedException (); }
47 public virtual XmlNodeList ChildNodes {
49 return new XmlNodeListChildren(LastLinkedChild);
53 public virtual XmlNode FirstChild {
55 if (LastChild != null) {
56 return LastLinkedChild.NextLinkedSibling;
64 public virtual bool HasChildNodes {
65 get { return LastChild != null; }
69 public virtual string InnerText {
70 get { throw new NotImplementedException (); }
71 set { throw new NotImplementedException (); }
75 public virtual string InnerXml {
76 get { throw new NotImplementedException (); }
77 set { throw new NotImplementedException (); }
81 public virtual bool IsReadOnly {
82 get { throw new NotImplementedException (); }
85 [System.Runtime.CompilerServices.IndexerName("Item")]
86 public virtual XmlElement this [string name] {
88 foreach (XmlNode node in ChildNodes) {
89 if ((node.NodeType == XmlNodeType.Element) &&
90 (node.Name == name)) {
91 return (XmlElement) node;
99 [System.Runtime.CompilerServices.IndexerName("Item")]
100 public virtual XmlElement this [string localname, string ns] {
102 foreach (XmlNode node in ChildNodes) {
103 if ((node.NodeType == XmlNodeType.Element) &&
104 (node.LocalName == localname) &&
105 (node.NamespaceURI == ns)) {
106 return (XmlElement) node;
114 public virtual XmlNode LastChild {
115 get { return LastLinkedChild; }
118 internal virtual XmlLinkedNode LastLinkedChild {
124 public abstract string LocalName { get; }
127 public abstract string Name { get; }
130 public virtual string NamespaceURI {
131 get { throw new NotImplementedException (); }
134 public virtual XmlNode NextSibling {
139 public abstract XmlNodeType NodeType { get; }
142 public virtual string OuterXml {
143 get { throw new NotImplementedException (); }
146 public virtual XmlDocument OwnerDocument {
147 get { return ownerDocument; }
150 public virtual XmlNode ParentNode {
151 get { return parentNode; }
155 public virtual string Prefix {
156 get { throw new NotImplementedException (); }
157 set { throw new NotImplementedException (); }
160 public virtual XmlNode PreviousSibling {
165 public virtual string Value {
166 get { throw new NotImplementedException (); }
167 set { throw new NotImplementedException (); }
174 public virtual XmlNode AppendChild (XmlNode newChild)
176 if (NodeType == XmlNodeType.Document || NodeType == XmlNodeType.Element || NodeType == XmlNodeType.Attribute) {
177 XmlLinkedNode newLinkedChild = (XmlLinkedNode)newChild;
178 XmlLinkedNode lastLinkedChild = LastLinkedChild;
179 if (lastLinkedChild != null) {
180 newLinkedChild.NextLinkedSibling = lastLinkedChild.NextLinkedSibling;
181 lastLinkedChild.NextLinkedSibling = newLinkedChild;
183 newLinkedChild.NextLinkedSibling = newLinkedChild;
184 LastLinkedChild = newLinkedChild;
187 throw new InvalidOperationException();
191 public virtual XmlNode Clone ()
193 throw new NotImplementedException ();
196 public abstract XmlNode CloneNode (bool deep);
199 public XPathNavigator CreateNavigator ()
201 throw new NotImplementedException ();
205 public IEnumerator GetEnumerator ()
207 throw new NotImplementedException ();
211 public virtual string GetNamespaceOfPrefix (string prefix)
213 throw new NotImplementedException ();
217 public virtual string GetPrefixOfNamespace (string namespaceURI)
219 throw new NotImplementedException ();
222 object ICloneable.Clone ()
227 IEnumerator IEnumerable.GetEnumerator ()
229 return GetEnumerator ();
233 public virtual XmlNode InsertAfter (XmlNode newChild, XmlNode refChild)
235 throw new NotImplementedException ();
239 public virtual XmlNode InsertBefore (XmlNode newChild, XmlNode refChild)
241 throw new NotImplementedException ();
245 public virtual void Normalize ()
247 throw new NotImplementedException ();
251 public virtual XmlNode PrependChild (XmlNode newChild)
253 throw new NotImplementedException ();
256 public virtual void RemoveAll ()
258 LastLinkedChild = null;
262 public virtual XmlNode RemoveChild (XmlNode oldChild)
264 throw new NotImplementedException ();
268 public virtual XmlNode ReplaceChild (XmlNode newChild, XmlNode oldChild)
270 throw new NotImplementedException ();
274 public virtual XmlNodeList SelectNodes (string xpath)
276 throw new NotImplementedException ();
280 public virtual XmlNodeList SelectNodes (string xpath, XmlNamespaceManager nsmgr)
282 throw new NotImplementedException ();
286 public virtual XmlNode SelectSingleNode (string xpath)
288 throw new NotImplementedException ();
292 public virtual XmlNode SelectSingleNode (string xpath, XmlNamespaceManager nsmgr)
294 throw new NotImplementedException ();
297 internal void SetParentNode (XmlNode parent)
303 public virtual bool Supports (string feature, string version)
305 throw new NotImplementedException ();
309 public abstract void WriteContentTo (XmlWriter w);
312 public abstract void WriteTo (XmlWriter w);