1 // -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
\r
3 // System.Xml.XmlDocument
\r
6 // Daniel Weber (daniel-weber@austin.rr.com)
\r
8 // (C) 2001 Daniel Weber
\r
13 namespace System.Xml
\r
16 public delegate void XmlNodeChangedEventHandler (XmlNodeChangedEventArgs args);
\r
19 /// Abstract class XmlNodeList.
\r
21 public class XmlDocument : XmlNode
\r
23 // Private data members
\r
24 XmlResolver _resolver = null;
\r
27 //===========================================================================
\r
28 public event XmlNodeChangedEventHandler NodeChanged;
\r
30 public event XmlNodeChangedEventHandler NodeChanging;
\r
32 public event XmlNodeChangedEventHandler NodeInserted;
\r
34 public event XmlNodeChangedEventHandler NodeInserting;
\r
36 public event XmlNodeChangedEventHandler NodeRemoved;
\r
38 public event XmlNodeChangedEventHandler NodeRemoving;
\r
40 // public properties
\r
43 /// Get the base URI for this document (the location from where the document was loaded)
\r
45 /// <example>If a document was loaded with doc.Load("c:\tmp\mydoc.xml"),
\r
46 /// then BaseURI would hold "c:\tmp\mydoc.xml"</example>
\r
47 public override string BaseURI
\r
51 // TODO - implement XmlDocument.BaseURI {get;}
\r
52 throw new NotImplementedException("BaseURI.get not implemented");
\r
57 /// Get the root element for the document. If no root exists, null is returned.
\r
59 public XmlElement DocumentElement
\r
63 // TODO - implement XmlDocument.Documentelement {get;}
\r
64 throw new NotImplementedException("XmlDocument.DocumentElement not implemented");
\r
69 /// Gets the node containing the DOCTYPE declaration.
\r
71 public virtual XmlDocumentType DocumentType
\r
75 // TODO - implement XmlDocument.DocumentType
\r
76 throw new NotImplementedException("XmlDocument.DocumentType not implemented");
\r
82 /// Get the XmlImplemenation for the current document.
\r
84 public XmlImplementation Implementation
\r
88 // TODO - implement XmlDocument.Implementation
\r
89 throw new NotImplementedException("Implementation not implemented");
\r
95 /// Get/Set the markup representing the children of the document.
\r
97 public override string InnerXml
\r
101 // TODO - implement XmlDocument.InnerXml {get;}
\r
102 throw new NotImplementedException("InnerXml get not implemented");
\r
106 // TODO - implement XmlDocument.InnerXml {set;}
\r
107 throw new NotImplementedException("InnerXml set not implemented");
\r
112 /// Get a value indicating if the document is read-only.
\r
114 public override bool IsReadOnly
\r
118 // TODO - implement XmlDocument.IsReadOnly {get;}
\r
119 throw new NotImplementedException("IsReadOnly get not implemented");
\r
126 public override string LocalName {
\r
129 // TODO - implement XmlDocument.LocalName {get;}
\r
130 throw new NotImplementedException("LocalName get not implemented");
\r
137 public override string Name
\r
141 // TODO - implement XmlDocument.Name {get;}
\r
142 throw new NotImplementedException("Name get not implemented");
\r
146 public XmlNameTable NameTable
\r
150 // TODO - implement XmlDocument.NameTable {get;}
\r
151 throw new NotImplementedException("NameTable get not implemented");
\r
156 public override XmlNodeType NodeType
\r
160 return XmlNodeType.Document;
\r
165 /// Returns OwnerDocument. For an XmlDocument, this property is always null.
\r
167 public override XmlDocument OwnerDocument
\r
175 public bool PreserveWhitespace
\r
179 // TODO - implement XmlDocument.PreserveWhitespace {get;}
\r
180 throw new NotImplementedException("PreserveWhitespace get not implemented");
\r
184 // TODO - implement XmlDocument.PreserveWhitespace {set;}
\r
185 throw new NotImplementedException("PreserveWhitespace set not implemented");
\r
189 public XmlResolver XmlResolver
\r
193 // TODO - Finish/test XmlDocument.XmlResolver {set;}
\r
199 //===========================================================================
\r
200 public override XmlNode CloneNode(bool deep)
\r
202 // TODO - implement XmlDocument.CloneNode(bool)
\r
203 throw new NotImplementedException("CloneNode(bool) not implemented");
\r
206 public XmlAttribute CreateAttribute(string name)
\r
208 // TODO - implement XmlDocument.CreateAttribute(string name)
\r
209 throw new NotImplementedException("CreateAttribute(string name) not implemented");
\r
212 public XmlAttribute CreateAttribute(string qualifiedName,string namespaceURI)
\r
214 // TODO - implement XmlDocument.CreateAttribute(string, string)
\r
215 throw new NotImplementedException("CreateAttribute(string, string) not implemented");
\r
218 public virtual XmlAttribute CreateAttribute(
\r
221 string namespaceURI
\r
224 // TODO - implement XmlDocument.CreateAttribute(prefix, localName, namespaceURI)
\r
225 throw new NotImplementedException("CreateAttribute(prefix, localName, namespaceURI) not implemented");
\r
228 public virtual XmlCDataSection CreateCDataSection(string data)
\r
230 // TODO - implement XmlDocument.CreateCDataSection(string data)
\r
231 throw new NotImplementedException("CreateCDataSection(string data) not implemented");
\r
235 public virtual XmlComment CreateComment(string data)
\r
237 // TODO - implement XmlDocument.CreateComment(string data)
\r
238 throw new NotImplementedException("CreateComment(string data) not implemented");
\r
241 public virtual XmlDocumentFragment CreateDocumentFragment()
\r
243 // TODO - implement XmlDocument.CreateDocumentFragment
\r
244 throw new NotImplementedException("CreateDocumentFragment not implemented");
\r
247 public virtual XmlDocumentType CreateDocumentType(
\r
251 string internalSubset
\r
254 // TODO - implement XmlDocument.CreateDocumentType
\r
255 throw new NotImplementedException("CreateDocumentType not implemented");
\r
258 public XmlElement CreateElement(string name)
\r
260 // TODO - implement XmlDocument.CreateElement(string name)
\r
261 throw new NotImplementedException("CreateElement(string name) not implemented");
\r
264 public XmlElement CreateElement(
\r
265 string qualifiedName,
\r
266 string namespaceURI
\r
269 // TODO - implement XmlDocument.CreateElement(string qualifiedName, string namespaceURI)
\r
270 throw new NotImplementedException("CreateElement(string qualifiedName, string namespaceURI) not implemented");
\r
273 public virtual XmlElement CreateElement(
\r
276 string namespaceURI
\r
279 // TODO - implement XmlDocument.CreateElement(prefix, localName, namespaceURI)
\r
280 throw new NotImplementedException("XmlDocument.CreateElement(prefix, localName, namespaceURI) not implemented.");
\r
284 public virtual XmlEntityReference CreateEntityReference(string name)
\r
286 // TODO - implement XmlDocument.CreateEntityReference
\r
287 throw new NotImplementedException("XmlDocument.CreateEntityReference not implemented.");
\r
290 public virtual XmlNode CreateNode(
\r
291 string nodeTypeString,
\r
293 string namespaceURI
\r
296 // TODO - implement XmlDocument.CreateNode(string, string, string)
\r
297 throw new NotImplementedException("XmlDocument.CreateNode not implemented.");
\r
300 public virtual XmlNode CreateNode(
\r
303 string namespaceURI
\r
306 // TODO - implement XmlDocument.CreateNode(XmlNodeType, string, string)
\r
307 throw new NotImplementedException("XmlDocument.CreateNode not implemented.");
\r
310 public virtual XmlNode CreateNode(
\r
314 string namespaceURI
\r
317 // TODO - implement XmlDocument.CreateNode(XmlNodeType, string, string, string)
\r
318 throw new NotImplementedException("XmlDocument.CreateNode not implemented.");
\r
321 public virtual XmlProcessingInstruction CreateProcessingInstruction(
\r
326 // TODO - implement XmlDocument.CreateProcessingInstruction
\r
327 throw new NotImplementedException("XmlDocument.CreateProcessingInstruction not implemented.");
\r
330 public virtual XmlSignificantWhitespace CreateSignificantWhitespace(string text )
\r
332 // TODO - implement XmlDocument.CreateSignificantWhitespace
\r
333 throw new NotImplementedException("XmlDocument.CreateSignificantWhitespace not implemented.");
\r
336 public virtual XmlText CreateTextNode(string text)
\r
338 // TODO - implement XmlDocument.CreateTextNode
\r
339 throw new NotImplementedException("XmlDocument.CreateTextNode not implemented.");
\r
342 public virtual XmlWhitespace CreateWhitespace(string text)
\r
344 // TODO - implement XmlDocument.CreateWhitespace
\r
345 throw new NotImplementedException("XmlDocument.CreateWhitespace not implemented.");
\r
348 public virtual XmlDeclaration CreateXmlDeclaration(
\r
354 // TODO - implement XmlDocument.CreateXmlDeclaration
\r
355 throw new NotImplementedException("XmlDocument.CreateXmlDeclaration not implemented.");
\r
358 public virtual XmlElement GetElementById(string elementId)
\r
360 // TODO - implement XmlDocument.GetElementById
\r
361 throw new NotImplementedException("XmlDocument.GetElementById not implemented.");
\r
364 public virtual XmlNodeList GetElementsByTagName(string name)
\r
366 // TODO - implement XmlDocument.GetElementsByTagName(name)
\r
367 throw new NotImplementedException("XmlDocument.GetElementsByTagName not implemented.");
\r
370 public virtual XmlNodeList GetElementsByTagName(
\r
372 string namespaceURI
\r
375 // TODO - implement XmlDocument.GetElementsByTagName(localName, namespaceURI)
\r
376 throw new NotImplementedException("XmlDocument.GetElementsByTagName not implemented.");
\r
379 public virtual XmlNode ImportNode(
\r
384 // TODO - implement XmlDocument.ImportNode
\r
385 throw new NotImplementedException("XmlDocument.ImportNode not implemented.");
\r
388 public virtual void Load(Stream inStream)
\r
390 // TODO - implement XmlDocument.Load(Stream)
\r
391 throw new NotImplementedException("XmlDocument.Load(Stream) not implemented.");
\r
394 public virtual void Load(string filename)
\r
396 // TODO - implement XmlDocument.Load(string)
\r
397 throw new NotImplementedException("XmlDocument.Load(string) not implemented.");
\r
400 public virtual void Load(TextReader txtReader)
\r
402 // TODO - implement XmlDocument.Load(TextReader)
\r
403 throw new NotImplementedException("XmlDocument.Load(TextReader) not implemented.");
\r
406 public virtual void Load(XmlReader reader)
\r
408 // TODO - implement XmlDocument.Load(XmlReader)
\r
409 throw new NotImplementedException("XmlDocument.Load(XmlReader) not implemented.");
\r
412 public virtual void LoadXml(string xml)
\r
414 // TODO - implement XmlDocument.LoadXml
\r
415 throw new NotImplementedException("XmlDocument.LoadXml not implemented.");
\r
418 public virtual void Save(Stream outStream)
\r
420 // TODO - implement XmlDocument.Save(Stream)
\r
421 throw new NotImplementedException("XmlDocument.Save(Stream) not implemented.");
\r
424 public virtual void Save(string filename)
\r
426 // TODO - implement XmlDocument.Save(string)
\r
427 throw new NotImplementedException("XmlDocument.Save(string) not implemented.");
\r
430 public virtual void Save(TextWriter writer)
\r
432 // TODO - implement XmlDocument.Save(TextWriter)
\r
433 throw new NotImplementedException("XmlDocument.Save(TextWriter) not implemented.");
\r
436 public virtual void Save(XmlWriter writer)
\r
438 // TODO - implement XmlDocument.Save(XmlWriter)
\r
439 throw new NotImplementedException("XmlDocument.Save(XmlWriter) not implemented.");
\r
442 public override void WriteContentTo(XmlWriter w)
\r
444 // TODO - implement XmlDocument.WriteContentTo
\r
445 throw new NotImplementedException("XmlDocument.WriteContentTo not implemented.");
\r
448 public override void WriteTo(XmlWriter w)
\r
450 // TODO - implement XmlDocument.WriteTo
\r
451 throw new NotImplementedException("XmlDocument.WriteTo not implemented.");
\r
455 // Internal functions
\r
456 //===========================================================================
\r
457 internal void onNodeChanging(XmlNode node, XmlNode Parent)
\r
459 if (NodeInserting != null)
\r
460 NodeChanging( new XmlNodeChangedEventArgs(XmlNodeChangedAction.Change,
\r
461 node, Parent, Parent));
\r
464 internal void onNodeChanged(XmlNode node, XmlNode Parent)
\r
466 if (NodeChanged != null)
\r
467 NodeInserted( new XmlNodeChangedEventArgs(XmlNodeChangedAction.Change,
\r
468 node, Parent, Parent));
\r
471 internal void onNodeInserting(XmlNode node, XmlNode newParent)
\r
473 if (NodeInserting != null)
\r
474 NodeInserting( new XmlNodeChangedEventArgs(XmlNodeChangedAction.Insert,
\r
475 node, null, newParent));
\r
478 internal void onNodeInserted(XmlNode node, XmlNode newParent)
\r
480 if (NodeInserted != null)
\r
481 NodeInserted( new XmlNodeChangedEventArgs(XmlNodeChangedAction.Insert,
\r
482 node, null, newParent));
\r
485 internal void onNodeRemoving(XmlNode node, XmlNode oldParent)
\r
487 if (NodeRemoving != null)
\r
488 NodeRemoving(new XmlNodeChangedEventArgs(XmlNodeChangedAction.Remove,
\r
489 node, oldParent, null));
\r
492 internal void onNodeRemoved(XmlNode node, XmlNode oldParent)
\r
494 if (NodeRemoved != null)
\r
495 NodeRemoved(new XmlNodeChangedEventArgs(XmlNodeChangedAction.Remove,
\r
496 node, oldParent, null));
\r
501 //===========================================================================
\r
502 public XmlDocument() : base(null)
\r