XmlDocument.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. // -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
  2. //
  3. // System.Xml.XmlDocument
  4. //
  5. // Author:
  6. // Daniel Weber ([email protected])
  7. //
  8. // (C) 2001 Daniel Weber
  9. using System;
  10. using System.IO;
  11. namespace System.Xml
  12. {
  13. /// <summary>
  14. /// Abstract class XmlNodeList.
  15. /// </summary>
  16. public class XmlDocument : XmlNode
  17. {
  18. // Private data members
  19. XmlResolver _resolver = null;
  20. // public properties
  21. /// <summary>
  22. /// Get the base URI for this document (the location from where the document was loaded)
  23. /// </summary>
  24. /// <example>If a document was loaded with doc.Load("c:\tmp\mydoc.xml"),
  25. /// then BaseURI would hold "c:\tmp\mydoc.xml"</example>
  26. public override string BaseURI
  27. {
  28. get
  29. {
  30. // TODO - implement XmlDocument.BaseURI {get;}
  31. throw new NotImplementedException("BaseURI.get not implemented");
  32. }
  33. }
  34. /// <summary>
  35. /// Get the root element for the document. If no root exists, null is returned.
  36. /// </summary>
  37. public XmlElement DocumentElement
  38. {
  39. get
  40. {
  41. // TODO - implement XmlDocument.Documentelement {get;}
  42. throw new NotImplementedException("XmlDocument.DocumentElement not implemented");
  43. }
  44. }
  45. /// <summary>
  46. /// Gets the node containing the DOCTYPE declaration.
  47. /// </summary>
  48. public virtual XmlDocumentType DocumentType
  49. {
  50. get
  51. {
  52. // TODO - implement XmlDocument.DocumentType
  53. throw new NotImplementedException("XmlDocument.DocumentType not implemented");
  54. }
  55. }
  56. /// <summary>
  57. /// Get the XmlImplemenation for the current document.
  58. /// </summary>
  59. public XmlImplementation Implementation
  60. {
  61. get
  62. {
  63. // TODO - implement XmlDocument.Implementation
  64. throw new NotImplementedException("Implementation not implemented");
  65. }
  66. }
  67. /// <summary>
  68. /// Get/Set the markup representing the children of the document.
  69. /// </summary>
  70. public override string InnerXml
  71. {
  72. get
  73. {
  74. // TODO - implement XmlDocument.InnerXml {get;}
  75. throw new NotImplementedException("InnerXml get not implemented");
  76. }
  77. set
  78. {
  79. // TODO - implement XmlDocument.InnerXml {set;}
  80. throw new NotImplementedException("InnerXml set not implemented");
  81. }
  82. }
  83. /// <summary>
  84. /// Get a value indicating if the document is read-only.
  85. /// </summary>
  86. public override bool IsReadOnly
  87. {
  88. get
  89. {
  90. // TODO - implement XmlDocument.IsReadOnly {get;}
  91. throw new NotImplementedException("IsReadOnly get not implemented");
  92. }
  93. }
  94. /// <summary>
  95. ///
  96. /// </summary>
  97. public override string LocalName {
  98. get
  99. {
  100. // TODO - implement XmlDocument.LocalName {get;}
  101. throw new NotImplementedException("LocalName get not implemented");
  102. }
  103. }
  104. /// <summary>
  105. ///
  106. /// </summary>
  107. public override string Name
  108. {
  109. get
  110. {
  111. // TODO - implement XmlDocument.Name {get;}
  112. throw new NotImplementedException("Name get not implemented");
  113. }
  114. }
  115. public XmlNameTable NameTable
  116. {
  117. get
  118. {
  119. // TODO - implement XmlDocument.NameTable {get;}
  120. throw new NotImplementedException("NameTable get not implemented");
  121. }
  122. }
  123. public override XmlNodeType NodeType
  124. {
  125. get
  126. {
  127. return XmlNodeType.Document;
  128. }
  129. }
  130. /// <summary>
  131. /// Returns OwnerDocument. For an XmlDocument, this property is always null.
  132. /// </summary>
  133. public override XmlDocument OwnerDocument
  134. {
  135. get
  136. {
  137. return null;
  138. }
  139. }
  140. public bool PreserveWhitespace
  141. {
  142. get
  143. {
  144. // TODO - implement XmlDocument.PreserveWhitespace {get;}
  145. throw new NotImplementedException("PreserveWhitespace get not implemented");
  146. }
  147. set
  148. {
  149. // TODO - implement XmlDocument.PreserveWhitespace {set;}
  150. throw new NotImplementedException("PreserveWhitespace set not implemented");
  151. }
  152. }
  153. public XmlResolver XmlResolver
  154. {
  155. set
  156. {
  157. // TODO - Finish/test XmlDocument.XmlResolver {set;}
  158. _resolver = value;
  159. }
  160. }
  161. // Public Methods
  162. //===========================================================================
  163. public override XmlNode CloneNode(bool deep)
  164. {
  165. // TODO - implement XmlDocument.CloneNode(bool)
  166. throw new NotImplementedException("CloneNode(bool) not implemented");
  167. }
  168. public XmlAttribute CreateAttribute(string name)
  169. {
  170. // TODO - implement XmlDocument.CreateAttribute(string name)
  171. throw new NotImplementedException("CreateAttribute(string name) not implemented");
  172. }
  173. public XmlAttribute CreateAttribute(string qualifiedName,string namespaceURI)
  174. {
  175. // TODO - implement XmlDocument.CreateAttribute(string, string)
  176. throw new NotImplementedException("CreateAttribute(string, string) not implemented");
  177. }
  178. public virtual XmlAttribute CreateAttribute(
  179. string prefix,
  180. string localName,
  181. string namespaceURI
  182. )
  183. {
  184. // TODO - implement XmlDocument.CreateAttribute(prefix, localName, namespaceURI)
  185. throw new NotImplementedException("CreateAttribute(prefix, localName, namespaceURI) not implemented");
  186. }
  187. public virtual XmlCDataSection CreateCDataSection(string data)
  188. {
  189. // TODO - implement XmlDocument.CreateCDataSection(string data)
  190. throw new NotImplementedException("CreateCDataSection(string data) not implemented");
  191. }
  192. public virtual XmlComment CreateComment(string data)
  193. {
  194. // TODO - implement XmlDocument.CreateComment(string data)
  195. throw new NotImplementedException("CreateComment(string data) not implemented");
  196. }
  197. public virtual XmlDocumentFragment CreateDocumentFragment()
  198. {
  199. // TODO - implement XmlDocument.CreateDocumentFragment
  200. throw new NotImplementedException("CreateDocumentFragment not implemented");
  201. }
  202. public virtual XmlDocumentType CreateDocumentType(
  203. string name,
  204. string publicId,
  205. string systemId,
  206. string internalSubset
  207. )
  208. {
  209. // TODO - implement XmlDocument.CreateDocumentType
  210. throw new NotImplementedException("CreateDocumentType not implemented");
  211. }
  212. public XmlElement CreateElement(string name)
  213. {
  214. // TODO - implement XmlDocument.CreateElement(string name)
  215. throw new NotImplementedException("CreateElement(string name) not implemented");
  216. }
  217. public XmlElement CreateElement(
  218. string qualifiedName,
  219. string namespaceURI
  220. )
  221. {
  222. // TODO - implement XmlDocument.CreateElement(string qualifiedName, string namespaceURI)
  223. throw new NotImplementedException("CreateElement(string qualifiedName, string namespaceURI) not implemented");
  224. }
  225. public virtual XmlElement CreateElement(
  226. string prefix,
  227. string localName,
  228. string namespaceURI
  229. )
  230. {
  231. // TODO - implement XmlDocument.CreateElement(prefix, localName, namespaceURI)
  232. throw new NotImplementedException("XmlDocument.CreateElement(prefix, localName, namespaceURI) not implemented.");
  233. }
  234. public virtual XmlEntityReference CreateEntityReference(string name)
  235. {
  236. // TODO - implement XmlDocument.CreateEntityReference
  237. throw new NotImplementedException("XmlDocument.CreateEntityReference not implemented.");
  238. }
  239. public virtual XmlNode CreateNode(
  240. string nodeTypeString,
  241. string name,
  242. string namespaceURI
  243. )
  244. {
  245. // TODO - implement XmlDocument.CreateNode(string, string, string)
  246. throw new NotImplementedException("XmlDocument.CreateNode not implemented.");
  247. }
  248. public virtual XmlNode CreateNode(
  249. XmlNodeType type,
  250. string name,
  251. string namespaceURI
  252. )
  253. {
  254. // TODO - implement XmlDocument.CreateNode(XmlNodeType, string, string)
  255. throw new NotImplementedException("XmlDocument.CreateNode not implemented.");
  256. }
  257. public virtual XmlNode CreateNode(
  258. XmlNodeType type,
  259. string prefix,
  260. string name,
  261. string namespaceURI
  262. )
  263. {
  264. // TODO - implement XmlDocument.CreateNode(XmlNodeType, string, string, string)
  265. throw new NotImplementedException("XmlDocument.CreateNode not implemented.");
  266. }
  267. public virtual XmlProcessingInstruction CreateProcessingInstruction(
  268. string target,
  269. string data
  270. )
  271. {
  272. // TODO - implement XmlDocument.CreateProcessingInstruction
  273. throw new NotImplementedException("XmlDocument.CreateProcessingInstruction not implemented.");
  274. }
  275. public virtual XmlSignificantWhitespace CreateSignificantWhitespace(string text )
  276. {
  277. // TODO - implement XmlDocument.CreateSignificantWhitespace
  278. throw new NotImplementedException("XmlDocument.CreateSignificantWhitespace not implemented.");
  279. }
  280. public virtual XmlText CreateTextNode(string text)
  281. {
  282. // TODO - implement XmlDocument.CreateTextNode
  283. throw new NotImplementedException("XmlDocument.CreateTextNode not implemented.");
  284. }
  285. public virtual XmlWhitespace CreateWhitespace(string text)
  286. {
  287. // TODO - implement XmlDocument.CreateWhitespace
  288. throw new NotImplementedException("XmlDocument.CreateWhitespace not implemented.");
  289. }
  290. public virtual XmlDeclaration CreateXmlDeclaration(
  291. string version,
  292. string encoding,
  293. string standalone
  294. )
  295. {
  296. // TODO - implement XmlDocument.CreateXmlDeclaration
  297. throw new NotImplementedException("XmlDocument.CreateXmlDeclaration not implemented.");
  298. }
  299. public override bool Equals(object obj)
  300. {
  301. // TODO - implement XmlDocument.Equals(object obj)
  302. throw new NotImplementedException("XmlDocument.Equals(object obj) not implemented.");
  303. }
  304. public static bool Equals(
  305. object objA,
  306. object objB
  307. )
  308. {
  309. // TODO - implement XmlDocument.Equals(object objA, objB)
  310. throw new NotImplementedException("XmlDocument.Equals(object objA, objB) not implemented.");
  311. }
  312. public virtual XmlElement GetElementById(string elementId)
  313. {
  314. // TODO - implement XmlDocument.GetElementById
  315. throw new NotImplementedException("XmlDocument.GetElementById not implemented.");
  316. }
  317. public virtual XmlNodeList GetElementsByTagName(string name)
  318. {
  319. // TODO - implement XmlDocument.GetElementsByTagName(name)
  320. throw new NotImplementedException("XmlDocument.GetElementsByTagName not implemented.");
  321. }
  322. public virtual XmlNodeList GetElementsByTagName(
  323. string localName,
  324. string namespaceURI
  325. )
  326. {
  327. // TODO - implement XmlDocument.GetElementsByTagName(localName, namespaceURI)
  328. throw new NotImplementedException("XmlDocument.GetElementsByTagName not implemented.");
  329. }
  330. public virtual XmlNode ImportNode(
  331. XmlNode node,
  332. bool deep
  333. )
  334. {
  335. // TODO - implement XmlDocument.ImportNode
  336. throw new NotImplementedException("XmlDocument.ImportNode not implemented.");
  337. }
  338. public virtual void Load(Stream inStream)
  339. {
  340. // TODO - implement XmlDocument.Load(Stream)
  341. throw new NotImplementedException("XmlDocument.Load(Stream) not implemented.");
  342. }
  343. public virtual void Load(string filename)
  344. {
  345. // TODO - implement XmlDocument.Load(string)
  346. throw new NotImplementedException("XmlDocument.Load(string) not implemented.");
  347. }
  348. public virtual void Load(TextReader txtReader)
  349. {
  350. // TODO - implement XmlDocument.Load(TextReader)
  351. throw new NotImplementedException("XmlDocument.Load(TextReader) not implemented.");
  352. }
  353. public virtual void Load(XmlReader reader)
  354. {
  355. // TODO - implement XmlDocument.Load(XmlReader)
  356. throw new NotImplementedException("XmlDocument.Load(XmlReader) not implemented.");
  357. }
  358. public virtual void LoadXml(string xml)
  359. {
  360. // TODO - implement XmlDocument.LoadXml
  361. throw new NotImplementedException("XmlDocument.LoadXml not implemented.");
  362. }
  363. public virtual void Save(Stream outStream)
  364. {
  365. // TODO - implement XmlDocument.Save(Stream)
  366. throw new NotImplementedException("XmlDocument.Save(Stream) not implemented.");
  367. }
  368. public virtual void Save(string filename)
  369. {
  370. // TODO - implement XmlDocument.Save(string)
  371. throw new NotImplementedException("XmlDocument.Save(string) not implemented.");
  372. }
  373. public virtual void Save(TextWriter writer)
  374. {
  375. // TODO - implement XmlDocument.Save(TextWriter)
  376. throw new NotImplementedException("XmlDocument.Save(TextWriter) not implemented.");
  377. }
  378. public virtual void Save(XmlWriter writer)
  379. {
  380. // TODO - implement XmlDocument.Save(XmlWriter)
  381. throw new NotImplementedException("XmlDocument.Save(XmlWriter) not implemented.");
  382. }
  383. public override void WriteContentTo(XmlWriter w)
  384. {
  385. // TODO - implement XmlDocument.WriteContentTo
  386. throw new NotImplementedException("XmlDocument.WriteContentTo not implemented.");
  387. }
  388. public override void WriteTo(XmlWriter w)
  389. {
  390. // TODO - implement XmlDocument.WriteTo
  391. throw new NotImplementedException("XmlDocument.WriteTo not implemented.");
  392. }
  393. // Public events
  394. //===========================================================================
  395. public delegate void XmlNodeChangedEventHandler (XmlNodeChangedEventArgs args);
  396. public event XmlNodeChangedEventHandler NodeChanged;
  397. public event XmlNodeChangedEventHandler NodeChanging;
  398. public event XmlNodeChangedEventHandler NodeInserted;
  399. public event XmlNodeChangedEventHandler NodeInserting;
  400. public event XmlNodeChangedEventHandler NodeRemoved;
  401. public event XmlNodeChangedEventHandler NodeRemoving;
  402. // Constructors
  403. //===========================================================================
  404. }
  405. }