XmlDocumentCF 1.0

System.Xml (system.xml.dll)class

This class represents an XML document according to the W3C DOM (Document Object Model) specification. The document is represented as a node tree, in which elements and attributes (and their values) are stored as nodes that contain relational information (e.g., parent, child, siblings). XmlDocument derives from the generic XmlNode class and therefore has a node-type of Document.

The set of Create* methods create new objects of any type of node. These objects are created within the context of the XmlDocument; they share the document properties and name table of the parent document. However, they are not inserted into the document. To do this, you need to use the methods for node insertion from XmlNode. A new XmlNode is created from the root node of the XmlDocument; then methods for walking the node tree and appending or inserting nodes can be used to alter the source document.

Events are noted when any nodes (even created node objects that have not been inserted into the document) from this object change. Register an instance of the XmlNodeChangedEventHandler delegate with any of the following event types on XmlDocument to receive the corresponding notification: NodeChanged or NodeChanging for notification when a node has or is in the middle of changing (the element name is being modified, an attribute is being modified, added, or removed, and so on); NodeInserted or NodeInserting for notifications of new nodes having been or in the process of being added to the document; and NodeRemoved or NodeRemoving for nodes removed or in the process of being removed. The XmlNodeChangedEventHandler takes two arguments: the object sending the notification (this object), and an XmlNodeChangedEventArgs instance containing information about the change.

public class XmlDocument : XmlNode {
// Public Constructors
   public XmlDocument( );
   public XmlDocument(XmlNameTable nt);
// Protected Constructors
   protected internal XmlDocument(XmlImplementation imp);
// Public Instance Properties
   public override string BaseURI{get; } 
// overrides XmlNode
   public XmlElement DocumentElement{get; }
   public virtual XmlDocumentType DocumentType{get; }
   public XmlImplementation Implementation{get; }
   public override string InnerXml{set; get; }        
// overrides XmlNode
   public override bool IsReadOnly{get; }
// overrides XmlNode
   public override string LocalName{get; }            
// overrides XmlNode
   public override string Name{get; }    
// overrides XmlNode
   public XmlNameTable NameTable{get; }
   public override XmlNodeType NodeType{get; }        
// overrides XmlNode
   public override XmlDocument OwnerDocument{get; }   
// overrides XmlNode
   public bool PreserveWhitespace{set; get; }
   public virtual XmlResolver XmlResolver{set; }
// Public Instance Methods
   public override XmlNode CloneNode(bool deep);     
// overrides XmlNode
   public XmlAttribute CreateAttribute(string name);
   public XmlAttribute CreateAttribute(string qualifiedName, string namespaceURI);
   public virtual XmlAttribute CreateAttribute(string prefix, string localName, 
        string namespaceURI);
   public virtual XmlCDataSection CreateCDataSection(string data);
   public virtual XmlComment CreateComment(string data);
   public virtual XmlDocumentFragment CreateDocumentFragment( );  internalSubset);
   public virtual XmlDocumentType CreateDocumentType(string name, string publicId, 
        string systemId,  string
   public XmlElement CreateElement(string name);
   public XmlElement CreateElement(string qualifiedName, string namespaceURI);
   public virtual XmlElement CreateElement(string prefix, string localName, string namespaceURI);
   public virtual XmlEntityReference CreateEntityReference(string name);
   public virtual XmlNode CreateNode(string nodeTypeString, string name, string namespaceURI);
   public virtual XmlNode CreateNode(XmlNodeType type, string name, string namespaceURI);
   public virtual XmlNode CreateNode(XmlNodeType type, string prefix, string name, 
        string namespaceURI);
   public virtual XmlProcessingInstruction CreateProcessingInstruction(string target, string data);
   public virtual XmlSignificantWhitespace CreateSignificantWhitespace(string text);
   public virtual XmlText CreateTextNode(string text);
   public virtual XmlWhitespace CreateWhitespace(string text);
   public virtual XmlDeclaration CreateXmlDeclaration(string version, string encoding, 
        string standalone);
   public virtual XmlElement GetElementById(string elementId);
   public virtual XmlNodeList GetElementsByTagName(string name);
   public virtual XmlNodeList GetElementsByTagName(string localName, string namespaceURI);
   public virtual XmlNode ImportNode(XmlNode node, bool deep);
   public virtual void Load(System.IO.Stream inStream);
   public virtual void Load(string filename);
   public virtual void Load(System.IO.TextReader txtReader);
   public virtual void Load(XmlReader reader);
   public virtual void LoadXml(string xml);
   public virtual XmlNode ReadNode(XmlReader reader);
   public virtual void Save(System.IO.Stream outStream);
   public virtual void Save(string filename);
   public virtual void Save(System.IO.TextWriter writer);
   public virtual void Save(XmlWriter w);
   public override void WriteContentTo(XmlWriter xw);
// overrides XmlNode
   public override void WriteTo(XmlWriter w);        
// overrides XmlNode
// Protected Instance Methods
   protected internal virtual XmlAttribute CreateDefaultAttribute(string prefix, string localName, 
        string namespaceURI);
   protected internal virtual XPathNavigator CreateNavigator(XmlNode node);
// 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;


System.Object XmlNode(System.ICloneable, System.Collections.IEnumerable, System.Xml.XPath.IXPathNavigable) XmlDocument



Returned By

XmlImplementation.CreateDocument( ), XmlNode.OwnerDocument

    Part II: Programming with the .NET Framework
    Part IV: API Quick Reference
    Chapter 26. System