| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506 |
- // -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- //
- // System.Xml.XmlDocument
- //
- // Author:
- // Daniel Weber ([email protected])
- //
- // (C) 2001 Daniel Weber
- using System;
- using System.IO;
- namespace System.Xml
- {
- public delegate void XmlNodeChangedEventHandler (XmlNodeChangedEventArgs args);
- /// <summary>
- /// Abstract class XmlNodeList.
- /// </summary>
- public class XmlDocument : XmlNode
- {
- // Private data members
- XmlResolver _resolver = null;
- // Public events
- //===========================================================================
- public event XmlNodeChangedEventHandler NodeChanged;
- public event XmlNodeChangedEventHandler NodeChanging;
- public event XmlNodeChangedEventHandler NodeInserted;
- public event XmlNodeChangedEventHandler NodeInserting;
- public event XmlNodeChangedEventHandler NodeRemoved;
- public event XmlNodeChangedEventHandler NodeRemoving;
- // public properties
-
- /// <summary>
- /// Get the base URI for this document (the location from where the document was loaded)
- /// </summary>
- /// <example>If a document was loaded with doc.Load("c:\tmp\mydoc.xml"),
- /// then BaseURI would hold "c:\tmp\mydoc.xml"</example>
- public override string BaseURI
- {
- get
- {
- // TODO - implement XmlDocument.BaseURI {get;}
- throw new NotImplementedException("BaseURI.get not implemented");
- }
- }
- /// <summary>
- /// Get the root element for the document. If no root exists, null is returned.
- /// </summary>
- public XmlElement DocumentElement
- {
- get
- {
- // TODO - implement XmlDocument.Documentelement {get;}
- throw new NotImplementedException("XmlDocument.DocumentElement not implemented");
- }
- }
- /// <summary>
- /// Gets the node containing the DOCTYPE declaration.
- /// </summary>
- public virtual XmlDocumentType DocumentType
- {
- get
- {
- // TODO - implement XmlDocument.DocumentType
- throw new NotImplementedException("XmlDocument.DocumentType not implemented");
- }
- }
- /// <summary>
- /// Get the XmlImplemenation for the current document.
- /// </summary>
- public XmlImplementation Implementation
- {
- get
- {
- // TODO - implement XmlDocument.Implementation
- throw new NotImplementedException("Implementation not implemented");
- }
- }
- /// <summary>
- /// Get/Set the markup representing the children of the document.
- /// </summary>
- public override string InnerXml
- {
- get
- {
- // TODO - implement XmlDocument.InnerXml {get;}
- throw new NotImplementedException("InnerXml get not implemented");
- }
- set
- {
- // TODO - implement XmlDocument.InnerXml {set;}
- throw new NotImplementedException("InnerXml set not implemented");
- }
- }
- /// <summary>
- /// Get a value indicating if the document is read-only.
- /// </summary>
- public override bool IsReadOnly
- {
- get
- {
- // TODO - implement XmlDocument.IsReadOnly {get;}
- throw new NotImplementedException("IsReadOnly get not implemented");
- }
- }
- /// <summary>
- /// Get the local name of the node. For documents, returns "#document"
- /// </summary>
- public override string LocalName {
- get
- {
- return "#document";
- }
- }
- /// <summary>
- /// Get the qualified name of the node. For documents, returns "#document"
- /// </summary>
- public override string Name
- {
- get
- {
- return "#document";
- }
- }
- public XmlNameTable NameTable
- {
- get
- {
- // TODO - implement XmlDocument.NameTable {get;}
- throw new NotImplementedException("NameTable get not implemented");
- }
- }
- public override XmlNodeType NodeType
- {
- get
- {
- return XmlNodeType.Document;
- }
- }
- /// <summary>
- /// Returns OwnerDocument. For an XmlDocument, this property is always null.
- /// </summary>
- public override XmlDocument OwnerDocument
- {
- get
- {
- return null;
- }
- }
- public bool PreserveWhitespace
- {
- get
- {
- // TODO - implement XmlDocument.PreserveWhitespace {get;}
- throw new NotImplementedException("PreserveWhitespace get not implemented");
- }
- set
- {
- // TODO - implement XmlDocument.PreserveWhitespace {set;}
- throw new NotImplementedException("PreserveWhitespace set not implemented");
- }
- }
- public XmlResolver XmlResolver
- {
- set
- {
- // TODO - Finish/test XmlDocument.XmlResolver {set;}
- _resolver = value;
- }
- }
- // Public Methods
- //===========================================================================
- public override XmlNode CloneNode(bool deep)
- {
- // TODO - implement XmlDocument.CloneNode(bool)
- throw new NotImplementedException("CloneNode(bool) not implemented");
- }
- public XmlAttribute CreateAttribute(string name)
- {
- // TODO - implement XmlDocument.CreateAttribute(string name)
- throw new NotImplementedException("CreateAttribute(string name) not implemented");
- }
- public XmlAttribute CreateAttribute(string qualifiedName,string namespaceURI)
- {
- // TODO - implement XmlDocument.CreateAttribute(string, string)
- throw new NotImplementedException("CreateAttribute(string, string) not implemented");
- }
- public virtual XmlAttribute CreateAttribute(
- string prefix,
- string localName,
- string namespaceURI
- )
- {
- // TODO - implement XmlDocument.CreateAttribute(prefix, localName, namespaceURI)
- throw new NotImplementedException("CreateAttribute(prefix, localName, namespaceURI) not implemented");
- }
- public virtual XmlCDataSection CreateCDataSection(string data)
- {
- // TODO - implement XmlDocument.CreateCDataSection(string data)
- throw new NotImplementedException("CreateCDataSection(string data) not implemented");
- }
- public virtual XmlComment CreateComment(string data)
- {
- // TODO - implement XmlDocument.CreateComment(string data)
- throw new NotImplementedException("CreateComment(string data) not implemented");
- }
- public virtual XmlDocumentFragment CreateDocumentFragment()
- {
- // TODO - implement XmlDocument.CreateDocumentFragment
- throw new NotImplementedException("CreateDocumentFragment not implemented");
- }
- public virtual XmlDocumentType CreateDocumentType(
- string name,
- string publicId,
- string systemId,
- string internalSubset
- )
- {
- // TODO - implement XmlDocument.CreateDocumentType
- throw new NotImplementedException("CreateDocumentType not implemented");
- }
- public XmlElement CreateElement(string name)
- {
- // TODO - implement XmlDocument.CreateElement(string name)
- throw new NotImplementedException("CreateElement(string name) not implemented");
- }
- public XmlElement CreateElement(
- string qualifiedName,
- string namespaceURI
- )
- {
- // TODO - implement XmlDocument.CreateElement(string qualifiedName, string namespaceURI)
- throw new NotImplementedException("CreateElement(string qualifiedName, string namespaceURI) not implemented");
- }
- public virtual XmlElement CreateElement(
- string prefix,
- string localName,
- string namespaceURI
- )
- {
- // TODO - implement XmlDocument.CreateElement(prefix, localName, namespaceURI)
- throw new NotImplementedException("XmlDocument.CreateElement(prefix, localName, namespaceURI) not implemented.");
- }
- public virtual XmlEntityReference CreateEntityReference(string name)
- {
- // TODO - implement XmlDocument.CreateEntityReference
- throw new NotImplementedException("XmlDocument.CreateEntityReference not implemented.");
- }
- public virtual XmlNode CreateNode(
- string nodeTypeString,
- string name,
- string namespaceURI
- )
- {
- // TODO - implement XmlDocument.CreateNode(string, string, string)
- throw new NotImplementedException("XmlDocument.CreateNode not implemented.");
- }
- public virtual XmlNode CreateNode(
- XmlNodeType type,
- string name,
- string namespaceURI
- )
- {
- // TODO - implement XmlDocument.CreateNode(XmlNodeType, string, string)
- throw new NotImplementedException("XmlDocument.CreateNode not implemented.");
- }
- public virtual XmlNode CreateNode(
- XmlNodeType type,
- string prefix,
- string name,
- string namespaceURI
- )
- {
- // TODO - implement XmlDocument.CreateNode(XmlNodeType, string, string, string)
- throw new NotImplementedException("XmlDocument.CreateNode not implemented.");
- }
- public virtual XmlProcessingInstruction CreateProcessingInstruction(
- string target,
- string data
- )
- {
- // TODO - implement XmlDocument.CreateProcessingInstruction
- throw new NotImplementedException("XmlDocument.CreateProcessingInstruction not implemented.");
- }
- public virtual XmlSignificantWhitespace CreateSignificantWhitespace(string text )
- {
- // TODO - implement XmlDocument.CreateSignificantWhitespace
- throw new NotImplementedException("XmlDocument.CreateSignificantWhitespace not implemented.");
- }
- public virtual XmlText CreateTextNode(string text)
- {
- // TODO - implement XmlDocument.CreateTextNode
- throw new NotImplementedException("XmlDocument.CreateTextNode not implemented.");
- }
- public virtual XmlWhitespace CreateWhitespace(string text)
- {
- // TODO - implement XmlDocument.CreateWhitespace
- throw new NotImplementedException("XmlDocument.CreateWhitespace not implemented.");
- }
- public virtual XmlDeclaration CreateXmlDeclaration(
- string version,
- string encoding,
- string standalone
- )
- {
- // TODO - implement XmlDocument.CreateXmlDeclaration
- throw new NotImplementedException("XmlDocument.CreateXmlDeclaration not implemented.");
- }
- public virtual XmlElement GetElementById(string elementId)
- {
- // TODO - implement XmlDocument.GetElementById
- throw new NotImplementedException("XmlDocument.GetElementById not implemented.");
- }
- public virtual XmlNodeList GetElementsByTagName(string name)
- {
- // TODO - implement XmlDocument.GetElementsByTagName(name)
- throw new NotImplementedException("XmlDocument.GetElementsByTagName not implemented.");
- }
- public virtual XmlNodeList GetElementsByTagName(
- string localName,
- string namespaceURI
- )
- {
- // TODO - implement XmlDocument.GetElementsByTagName(localName, namespaceURI)
- throw new NotImplementedException("XmlDocument.GetElementsByTagName not implemented.");
- }
- public virtual XmlNode ImportNode(
- XmlNode node,
- bool deep
- )
- {
- // TODO - implement XmlDocument.ImportNode
- throw new NotImplementedException("XmlDocument.ImportNode not implemented.");
- }
- public virtual void Load(Stream inStream)
- {
- // TODO - implement XmlDocument.Load(Stream)
- throw new NotImplementedException("XmlDocument.Load(Stream) not implemented.");
- }
- public virtual void Load(string filename)
- {
- // TODO - implement XmlDocument.Load(string)
- throw new NotImplementedException("XmlDocument.Load(string) not implemented.");
- }
- public virtual void Load(TextReader txtReader)
- {
- // TODO - implement XmlDocument.Load(TextReader)
- throw new NotImplementedException("XmlDocument.Load(TextReader) not implemented.");
- }
- public virtual void Load(XmlReader reader)
- {
- // TODO - implement XmlDocument.Load(XmlReader)
- throw new NotImplementedException("XmlDocument.Load(XmlReader) not implemented.");
- }
- public virtual void LoadXml(string xml)
- {
- // TODO - implement XmlDocument.LoadXml
- throw new NotImplementedException("XmlDocument.LoadXml not implemented.");
- }
- public virtual void Save(Stream outStream)
- {
- // TODO - implement XmlDocument.Save(Stream)
- throw new NotImplementedException("XmlDocument.Save(Stream) not implemented.");
- }
- public virtual void Save(string filename)
- {
- // TODO - implement XmlDocument.Save(string)
- throw new NotImplementedException("XmlDocument.Save(string) not implemented.");
- }
- public virtual void Save(TextWriter writer)
- {
- // TODO - implement XmlDocument.Save(TextWriter)
- throw new NotImplementedException("XmlDocument.Save(TextWriter) not implemented.");
- }
- public virtual void Save(XmlWriter writer)
- {
- // TODO - implement XmlDocument.Save(XmlWriter)
- throw new NotImplementedException("XmlDocument.Save(XmlWriter) not implemented.");
- }
- public override void WriteContentTo(XmlWriter w)
- {
- // TODO - implement XmlDocument.WriteContentTo
- throw new NotImplementedException("XmlDocument.WriteContentTo not implemented.");
- }
- public override void WriteTo(XmlWriter w)
- {
- // TODO - implement XmlDocument.WriteTo
- throw new NotImplementedException("XmlDocument.WriteTo not implemented.");
- }
- // Internal functions
- //===========================================================================
- internal void onNodeChanging(XmlNode node, XmlNode Parent)
- {
- if (NodeInserting != null)
- NodeChanging( new XmlNodeChangedEventArgs(XmlNodeChangedAction.Change,
- node, Parent, Parent));
- }
- internal void onNodeChanged(XmlNode node, XmlNode Parent)
- {
- if (NodeChanged != null)
- NodeInserted( new XmlNodeChangedEventArgs(XmlNodeChangedAction.Change,
- node, Parent, Parent));
- }
- internal void onNodeInserting(XmlNode node, XmlNode newParent)
- {
- if (NodeInserting != null)
- NodeInserting( new XmlNodeChangedEventArgs(XmlNodeChangedAction.Insert,
- node, null, newParent));
- }
- internal void onNodeInserted(XmlNode node, XmlNode newParent)
- {
- if (NodeInserted != null)
- NodeInserted( new XmlNodeChangedEventArgs(XmlNodeChangedAction.Insert,
- node, null, newParent));
- }
- internal void onNodeRemoving(XmlNode node, XmlNode oldParent)
- {
- if (NodeRemoving != null)
- NodeRemoving(new XmlNodeChangedEventArgs(XmlNodeChangedAction.Remove,
- node, oldParent, null));
- }
- internal void onNodeRemoved(XmlNode node, XmlNode oldParent)
- {
- if (NodeRemoved != null)
- NodeRemoved(new XmlNodeChangedEventArgs(XmlNodeChangedAction.Remove,
- node, oldParent, null));
- }
- // Constructors
- //===========================================================================
- public XmlDocument() : base(null)
- {
- }
-
- }
- }
|