10 out of 19 rated this helpful Rate this topic

XmlDocument Class

Represents an XML document.

Namespace:  System.Xml
Assembly:  System.Xml (in System.Xml.dll)
public class XmlDocument : XmlNode

The XmlDocument type exposes the following members.

  Name Description
Public method Supported by the XNA Framework XmlDocument Initializes a new instance of the XmlDocument class.
Protected method Supported by the XNA Framework XmlDocument(XmlImplementation) Initializes a new instance of the XmlDocument class with the specified XmlImplementation.
Public method Supported by the XNA Framework XmlDocument(XmlNameTable) Initializes a new instance of the XmlDocument class with the specified XmlNameTable.
Top
  Name Description
Public property Supported by the XNA Framework Attributes Gets an XmlAttributeCollection containing the attributes of this node. (Inherited from XmlNode.)
Public property Supported by the XNA Framework BaseURI Gets the base URI of the current node. (Overrides XmlNode.BaseURI.)
Public property Supported by the XNA Framework ChildNodes Gets all the child nodes of the node. (Inherited from XmlNode.)
Public property Supported by the XNA Framework DocumentElement Gets the root XmlElement for the document.
Public property DocumentType Gets the node containing the DOCTYPE declaration.
Public property Supported by the XNA Framework FirstChild Gets the first child of the node. (Inherited from XmlNode.)
Public property Supported by the XNA Framework HasChildNodes Gets a value indicating whether this node has any child nodes. (Inherited from XmlNode.)
Public property Supported by the XNA Framework Implementation Gets the XmlImplementation object for the current document.
Public property Supported by the XNA Framework InnerText Gets the concatenated values of the node and all its child nodes. (Overrides XmlNode.InnerText.)

In XNA Framework 3.0, this member is inherited from XmlNode.InnerText.
Public property Supported by the XNA Framework InnerXml Gets or sets the markup representing the children of the current node. (Overrides XmlNode.InnerXml.)
Public property Supported by the XNA Framework IsReadOnly Gets a value indicating whether the current node is read-only. (Overrides XmlNode.IsReadOnly.)
Public property Supported by the XNA Framework Item(String) Gets the first child element with the specified Name. (Inherited from XmlNode.)
Public property Supported by the XNA Framework Item(String, String) Gets the first child element with the specified LocalName and NamespaceURI. (Inherited from XmlNode.)
Public property Supported by the XNA Framework LastChild Gets the last child of the node. (Inherited from XmlNode.)
Public property Supported by the XNA Framework LocalName Gets the local name of the node. (Overrides XmlNode.LocalName.)
Public property Supported by the XNA Framework Name Gets the qualified name of the node. (Overrides XmlNode.Name.)
Public property Supported by the XNA Framework NamespaceURI Gets the namespace URI of this node. (Inherited from XmlNode.)
Public property Supported by the XNA Framework NameTable Gets the XmlNameTable associated with this implementation.
Public property Supported by the XNA Framework NextSibling Gets the node immediately following this node. (Inherited from XmlNode.)
Public property Supported by the XNA Framework NodeType Gets the type of the current node. (Overrides XmlNode.NodeType.)
Public property Supported by the XNA Framework OuterXml Gets the markup representing this node and all its child nodes. (Inherited from XmlNode.)
Public property Supported by the XNA Framework OwnerDocument Gets the XmlDocument to which the current node belongs. (Overrides XmlNode.OwnerDocument.)
Public property Supported by the XNA Framework ParentNode Gets the parent node of this node (for nodes that can have parents). (Overrides XmlNode.ParentNode.)
Public property Supported by the XNA Framework Prefix Gets or sets the namespace prefix of this node. (Inherited from XmlNode.)
Public property Supported by the XNA Framework PreserveWhitespace Gets or sets a value indicating whether to preserve white space in element content.
Public property Supported by the XNA Framework PreviousSibling Gets the node immediately preceding this node. (Inherited from XmlNode.)
Public property Supported by the XNA Framework SchemaInfo Returns the Post-Schema-Validation-Infoset (PSVI) of the node. (Overrides XmlNode.SchemaInfo.)
Public property Supported by the XNA Framework Schemas Gets or sets the XmlSchemaSet object associated with this XmlDocument.
Public property Supported by the XNA Framework Value Gets or sets the value of the node. (Inherited from XmlNode.)
Public property Supported by the XNA Framework XmlResolver Sets the XmlResolver to use for resolving external resources.
Top
  Name Description
Public method Supported by the XNA Framework AppendChild Adds the specified node to the end of the list of child nodes, of this node. (Inherited from XmlNode.)
Public method Supported by the XNA Framework Clone Creates a duplicate of this node. (Inherited from XmlNode.)
Public method Supported by the XNA Framework CloneNode Creates a duplicate of this node. (Overrides XmlNode.CloneNode(Boolean).)
Public method Supported by the XNA Framework CreateAttribute(String) Creates an XmlAttribute with the specified Name.
Public method Supported by the XNA Framework CreateAttribute(String, String) Creates an XmlAttribute with the specified qualified name and NamespaceURI.
Public method Supported by the XNA Framework CreateAttribute(String, String, String) Creates an XmlAttribute with the specified Prefix, LocalName, and NamespaceURI.
Public method Supported by the XNA Framework CreateCDataSection Creates an XmlCDataSection containing the specified data.
Public method Supported by the XNA Framework CreateComment Creates an XmlComment containing the specified data.
Protected method Supported by the XNA Framework CreateDefaultAttribute Creates a default attribute with the specified prefix, local name and namespace URI.
Public method Supported by the XNA Framework CreateDocumentFragment Creates an XmlDocumentFragment.
Public method CreateDocumentType Returns a new XmlDocumentType object.
Public method Supported by the XNA Framework CreateElement(String) Creates an element with the specified name.
Public method Supported by the XNA Framework CreateElement(String, String) Creates an XmlElement with the qualified name and NamespaceURI.
Public method Supported by the XNA Framework CreateElement(String, String, String) Creates an element with the specified Prefix, LocalName, and NamespaceURI.
Public method Supported by the XNA Framework CreateEntityReference Creates an XmlEntityReference with the specified name.
Public method CreateNavigator Creates a new XPathNavigator object for navigating this document. (Overrides XmlNode.CreateNavigator.)
Protected method CreateNavigator(XmlNode) Creates an XPathNavigator object for navigating this document positioned on the XmlNode specified.
Public method Supported by the XNA Framework CreateNode(String, String, String) Creates an XmlNode with the specified node type, Name, and NamespaceURI.
Public method Supported by the XNA Framework CreateNode(XmlNodeType, String, String) Creates an XmlNode with the specified XmlNodeType, Name, and NamespaceURI.
Public method Supported by the XNA Framework CreateNode(XmlNodeType, String, String, String) Creates a XmlNode with the specified XmlNodeType, Prefix, Name, and NamespaceURI.
Public method Supported by the XNA Framework CreateProcessingInstruction Creates an XmlProcessingInstruction with the specified name and data.
Public method Supported by the XNA Framework CreateSignificantWhitespace Creates an XmlSignificantWhitespace node.
Public method Supported by the XNA Framework CreateTextNode Creates an XmlText with the specified text.
Public method Supported by the XNA Framework CreateWhitespace Creates an XmlWhitespace node.
Public method Supported by the XNA Framework CreateXmlDeclaration Creates an XmlDeclaration node with the specified values.
Public method Supported by the XNA Framework Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Supported by the XNA Framework Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetElementById Gets the XmlElement with the specified ID.
Public method Supported by the XNA Framework GetElementsByTagName(String) Returns an XmlNodeList containing a list of all descendant elements that match the specified Name.
Public method Supported by the XNA Framework GetElementsByTagName(String, String) Returns an XmlNodeList containing a list of all descendant elements that match the specified LocalName and NamespaceURI.
Public method Supported by the XNA Framework GetEnumerator Provides support for the for each style iteration over the nodes in the XmlNode. (Inherited from XmlNode.)
Public method Supported by the XNA Framework GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method Supported by the XNA Framework GetNamespaceOfPrefix Looks up the closest xmlns declaration for the given prefix that is in scope for the current node and returns the namespace URI in the declaration. (Inherited from XmlNode.)
Public method Supported by the XNA Framework GetPrefixOfNamespace Looks up the closest xmlns declaration for the given namespace URI that is in scope for the current node and returns the prefix defined in that declaration. (Inherited from XmlNode.)
Public method Supported by the XNA Framework GetType Gets the Type of the current instance. (Inherited from Object.)
Public method Supported by the XNA Framework ImportNode Imports a node from another document to the current document.
Public method Supported by the XNA Framework InsertAfter Inserts the specified node immediately after the specified reference node. (Inherited from XmlNode.)
Public method Supported by the XNA Framework InsertBefore Inserts the specified node immediately before the specified reference node. (Inherited from XmlNode.)
Public method Supported by the XNA Framework Load(Stream) Loads the XML document from the specified stream.
Public method Supported by the XNA Framework Load(String) Loads the XML document from the specified URL.
Public method Supported by the XNA Framework Load(TextReader) Loads the XML document from the specified TextReader.
Public method Supported by the XNA Framework Load(XmlReader) Loads the XML document from the specified XmlReader.
Public method Supported by the XNA Framework LoadXml Loads the XML document from the specified string.
Protected method Supported by the XNA Framework MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method Supported by the XNA Framework Normalize Puts all XmlText nodes in the full depth of the sub-tree underneath this XmlNode into a "normal" form where only markup (that is, tags, comments, processing instructions, CDATA sections, and entity references) separates XmlText nodes, that is, there are no adjacent XmlText nodes. (Inherited from XmlNode.)
Public method Supported by the XNA Framework PrependChild Adds the specified node to the beginning of the list of child nodes for this node. (Inherited from XmlNode.)
Public method Supported by the XNA Framework ReadNode Creates an XmlNode object based on the information in the XmlReader. The reader must be positioned on a node or attribute.
Public method Supported by the XNA Framework RemoveAll Removes all the child nodes and/or attributes of the current node. (Inherited from XmlNode.)
Public method Supported by the XNA Framework RemoveChild Removes specified child node. (Inherited from XmlNode.)
Public method Supported by the XNA Framework ReplaceChild Replaces the child node oldChild with newChild node. (Inherited from XmlNode.)
Public method Supported by the XNA Framework Save(Stream) Saves the XML document to the specified stream.
Public method Supported by the XNA Framework Save(String) Saves the XML document to the specified file.
Public method Supported by the XNA Framework Save(TextWriter) Saves the XML document to the specified TextWriter.
Public method Supported by the XNA Framework Save(XmlWriter) Saves the XML document to the specified XmlWriter.
Public method Supported by the XNA Framework SelectNodes(String) Selects a list of nodes matching the XPath expression. (Inherited from XmlNode.)
Public method Supported by the XNA Framework SelectNodes(String, XmlNamespaceManager) Selects a list of nodes matching the XPath expression. Any prefixes found in the XPath expression are resolved using the supplied XmlNamespaceManager. (Inherited from XmlNode.)
Public method Supported by the XNA Framework SelectSingleNode(String) Selects the first XmlNode that matches the XPath expression. (Inherited from XmlNode.)
Public method Supported by the XNA Framework SelectSingleNode(String, XmlNamespaceManager) Selects the first XmlNode that matches the XPath expression. Any prefixes found in the XPath expression are resolved using the supplied XmlNamespaceManager. (Inherited from XmlNode.)
Public method Supported by the XNA Framework Supports Test if the DOM implementation implements a specific feature. (Inherited from XmlNode.)
Public method Supported by the XNA Framework ToString Returns a string that represents the current object. (Inherited from Object.)
Public method Supported by the XNA Framework Validate(ValidationEventHandler) Validates the XmlDocument against the XML Schema Definition Language (XSD) schemas contained in the Schemas property.
Public method Supported by the XNA Framework Validate(ValidationEventHandler, XmlNode) Validates the XmlNode object specified against the XML Schema Definition Language (XSD) schemas in the Schemas property.
Public method Supported by the XNA Framework WriteContentTo Saves all the children of the XmlDocument node to the specified XmlWriter. (Overrides XmlNode.WriteContentTo(XmlWriter).)
Public method Supported by the XNA Framework WriteTo Saves the XmlDocument node to the specified XmlWriter. (Overrides XmlNode.WriteTo(XmlWriter).)
Top
  Name Description
Public event Supported by the XNA Framework NodeChanged Occurs when the Value of a node belonging to this document has been changed.
Public event Supported by the XNA Framework NodeChanging Occurs when the Value of a node belonging to this document is about to be changed.
Public event Supported by the XNA Framework NodeInserted Occurs when a node belonging to this document has been inserted into another node.
Public event Supported by the XNA Framework NodeInserting Occurs when a node belonging to this document is about to be inserted into another node.
Public event Supported by the XNA Framework NodeRemoved Occurs when a node belonging to this document has been removed from its parent.
Public event Supported by the XNA Framework NodeRemoving Occurs when a node belonging to this document is about to be removed from the document.
Top
  Name Description
Explicit interface implemetation Private method Supported by the XNA Framework ICloneable.Clone For a description of this member, see XmlNode.Clone. (Inherited from XmlNode.)
Explicit interface implemetation Private method Supported by the XNA Framework IEnumerable.GetEnumerator For a description of this member, see XmlNode.GetEnumerator. (Inherited from XmlNode.)
Top

This class implements the W3C Document Object Model (DOM) Level 1 Core and the Core DOM Level 2. The DOM is an in-memory (cache) tree representation of an XML document and enables the navigation and editing of this document. Because XmlDocument implements the IXPathNavigable interface it can also be used as the source document for the XslTransform class.

The XmlDataDocument class extends XmlDocument and allows structured data to be stored, retrieved, and manipulated through a relational DataSet. This class allows components to mix XML and relational views of the underlying data.

For more information, see XML Document Object Model (DOM).

Security note Security Note

Exceptions raised as a result of using the XmlDocument class, such as the XmlException class may contain sensitive information that should not be exposed in untrusted scenarios. Exceptions should be properly handled so that this sensitive information is not exposed in untrusted scenarios.

Topic Location
How to: Load XML Data in the XML Web Server Control Building ASP .NET Web Applications
How to: Load XML Data in the XML Web Server Control Building ASP .NET Web Applications

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(2000 characters remaining)
Community Content Add
Annotations FAQ