only for RuBoard - do not distribute or recompile Previous Section Next Section
XmlDocument class

System.Xml (system.xml.dll)

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

Hierarchy

System.Objectfigs/U2192.gif XmlNode(System.ICloneable, System.Collections.IEnumerable, System.Xml.XPath.IXPathNavigable)figs/U2192.gif XmlDocument

Subclasses

XmlDataDocument

Returned By

XmlImplementation.CreateDocument(), XmlNode.OwnerDocument

only for RuBoard - do not distribute or recompile Previous Section Next Section