XmlNode.cs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. //
  2. // System.Xml.XmlNode
  3. //
  4. // Author:
  5. // Kral Ferch <[email protected]>
  6. //
  7. // (C) 2002 Kral Ferch
  8. //
  9. using System;
  10. using System.Collections;
  11. using System.Xml.XPath;
  12. namespace System.Xml
  13. {
  14. public abstract class XmlNode : ICloneable, IEnumerable, IXPathNavigable
  15. {
  16. #region Fields
  17. XmlDocument ownerDocument;
  18. XmlNode parentNode;
  19. #endregion
  20. #region Constructors
  21. protected internal XmlNode(XmlDocument ownerDocument)
  22. {
  23. this.ownerDocument = ownerDocument;
  24. }
  25. #endregion
  26. #region Properties
  27. public virtual XmlAttributeCollection Attributes
  28. {
  29. get { return null; }
  30. }
  31. [MonoTODO]
  32. public virtual string BaseURI
  33. {
  34. get { throw new NotImplementedException (); }
  35. }
  36. public virtual XmlNodeList ChildNodes {
  37. get {
  38. return new XmlNodeListChildren(LastLinkedChild);
  39. }
  40. }
  41. public virtual XmlNode FirstChild {
  42. get {
  43. if (LastChild != null) {
  44. return LastLinkedChild.NextLinkedSibling;
  45. }
  46. else {
  47. return null;
  48. }
  49. }
  50. }
  51. public virtual bool HasChildNodes {
  52. get { return LastChild != null; }
  53. }
  54. [MonoTODO]
  55. public virtual string InnerText {
  56. get { throw new NotImplementedException (); }
  57. set { throw new NotImplementedException (); }
  58. }
  59. [MonoTODO]
  60. public virtual string InnerXml {
  61. get { throw new NotImplementedException (); }
  62. set { throw new NotImplementedException (); }
  63. }
  64. [MonoTODO]
  65. public virtual bool IsReadOnly {
  66. get { throw new NotImplementedException (); }
  67. }
  68. [MonoTODO]
  69. [System.Runtime.CompilerServices.IndexerName("Item")]
  70. public virtual XmlElement this [string name] {
  71. get { throw new NotImplementedException (); }
  72. }
  73. [MonoTODO]
  74. [System.Runtime.CompilerServices.IndexerName("Item")]
  75. public virtual XmlElement this [string localname, string ns] {
  76. get { throw new NotImplementedException (); }
  77. }
  78. public virtual XmlNode LastChild {
  79. get { return LastLinkedChild; }
  80. }
  81. internal virtual XmlLinkedNode LastLinkedChild {
  82. get { return null; }
  83. set { }
  84. }
  85. [MonoTODO]
  86. public abstract string LocalName { get; }
  87. [MonoTODO]
  88. public abstract string Name { get; }
  89. [MonoTODO]
  90. public virtual string NamespaceURI {
  91. get { throw new NotImplementedException (); }
  92. }
  93. public virtual XmlNode NextSibling {
  94. get { return null; }
  95. }
  96. [MonoTODO]
  97. public abstract XmlNodeType NodeType { get; }
  98. [MonoTODO]
  99. public virtual string OuterXml {
  100. get { throw new NotImplementedException (); }
  101. }
  102. public virtual XmlDocument OwnerDocument {
  103. get { return ownerDocument; }
  104. }
  105. public virtual XmlNode ParentNode {
  106. get { return parentNode; }
  107. }
  108. [MonoTODO]
  109. public virtual string Prefix {
  110. get { throw new NotImplementedException (); }
  111. set { throw new NotImplementedException (); }
  112. }
  113. public virtual XmlNode PreviousSibling {
  114. get { return null; }
  115. }
  116. [MonoTODO]
  117. public virtual string Value {
  118. get { throw new NotImplementedException (); }
  119. set { throw new NotImplementedException (); }
  120. }
  121. #endregion
  122. #region Methods
  123. public virtual XmlNode AppendChild (XmlNode newChild)
  124. {
  125. if (NodeType == XmlNodeType.Document || NodeType == XmlNodeType.Element || NodeType == XmlNodeType.Attribute) {
  126. XmlLinkedNode newLinkedChild = (XmlLinkedNode)newChild;
  127. XmlLinkedNode lastLinkedChild = LastLinkedChild;
  128. if (lastLinkedChild != null) {
  129. newLinkedChild.NextLinkedSibling = lastLinkedChild.NextLinkedSibling;
  130. lastLinkedChild.NextLinkedSibling = newLinkedChild;
  131. } else
  132. newLinkedChild.NextLinkedSibling = newLinkedChild;
  133. LastLinkedChild = newLinkedChild;
  134. return newChild;
  135. } else
  136. throw new InvalidOperationException();
  137. }
  138. [MonoTODO]
  139. public virtual XmlNode Clone ()
  140. {
  141. throw new NotImplementedException ();
  142. }
  143. public abstract XmlNode CloneNode (bool deep);
  144. [MonoTODO]
  145. public XPathNavigator CreateNavigator ()
  146. {
  147. throw new NotImplementedException ();
  148. }
  149. [MonoTODO]
  150. public IEnumerator GetEnumerator ()
  151. {
  152. throw new NotImplementedException ();
  153. }
  154. [MonoTODO]
  155. public virtual string GetNamespaceOfPrefix (string prefix)
  156. {
  157. throw new NotImplementedException ();
  158. }
  159. [MonoTODO]
  160. public virtual string GetPrefixOfNamespace (string namespaceURI)
  161. {
  162. throw new NotImplementedException ();
  163. }
  164. object ICloneable.Clone ()
  165. {
  166. return Clone ();
  167. }
  168. IEnumerator IEnumerable.GetEnumerator ()
  169. {
  170. return GetEnumerator ();
  171. }
  172. [MonoTODO]
  173. public virtual XmlNode InsertAfter (XmlNode newChild, XmlNode refChild)
  174. {
  175. throw new NotImplementedException ();
  176. }
  177. [MonoTODO]
  178. public virtual XmlNode InsertBefore (XmlNode newChild, XmlNode refChild)
  179. {
  180. throw new NotImplementedException ();
  181. }
  182. [MonoTODO]
  183. public virtual void Normalize ()
  184. {
  185. throw new NotImplementedException ();
  186. }
  187. [MonoTODO]
  188. public virtual XmlNode PrependChild (XmlNode newChild)
  189. {
  190. throw new NotImplementedException ();
  191. }
  192. public virtual void RemoveAll ()
  193. {
  194. LastLinkedChild = null;
  195. }
  196. [MonoTODO]
  197. public virtual XmlNode RemoveChild (XmlNode oldChild)
  198. {
  199. throw new NotImplementedException ();
  200. }
  201. [MonoTODO]
  202. public virtual XmlNode ReplaceChild (XmlNode newChild, XmlNode oldChild)
  203. {
  204. throw new NotImplementedException ();
  205. }
  206. [MonoTODO]
  207. public virtual XmlNodeList SelectNodes (string xpath)
  208. {
  209. throw new NotImplementedException ();
  210. }
  211. [MonoTODO]
  212. public virtual XmlNodeList SelectNodes (string xpath, XmlNamespaceManager nsmgr)
  213. {
  214. throw new NotImplementedException ();
  215. }
  216. [MonoTODO]
  217. public virtual XmlNode SelectSingleNode (string xpath)
  218. {
  219. throw new NotImplementedException ();
  220. }
  221. [MonoTODO]
  222. public virtual XmlNode SelectSingleNode (string xpath, XmlNamespaceManager nsmgr)
  223. {
  224. throw new NotImplementedException ();
  225. }
  226. internal void SetParentNode (XmlNode parent)
  227. {
  228. parentNode = parent;
  229. }
  230. [MonoTODO]
  231. public virtual bool Supports (string feature, string version)
  232. {
  233. throw new NotImplementedException ();
  234. }
  235. [MonoTODO]
  236. public abstract void WriteContentTo (XmlWriter w);
  237. [MonoTODO]
  238. public abstract void WriteTo (XmlWriter w);
  239. #endregion
  240. }
  241. }