Share via


XmlDocument Class

Definition

Represents the top level of the XML source. This class includes members for retrieving and creating all other XML objects.

public ref class XmlDocument sealed
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class XmlDocument final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class XmlDocument final
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class XmlDocument
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class XmlDocument
function XmlDocument()
Public NotInheritable Class XmlDocument
Inheritance
Object Platform::Object IInspectable XmlDocument
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Constructors

XmlDocument()

Creates a new instance of the XmlDocument class.

Properties

Attributes

Gets the list of attributes of this node.

ChildNodes

Gets a list of children in the current node.

Doctype

For XML, this property gets the address of the node that specifies the DTD. This property returns Null for HTML documents and XML documents without a DTD.

DocumentElement

Gets the root element of the document.

DocumentUri

Returns the URL for the last loaded XML document.

FirstChild

Gets the first child node.

Implementation

Gets the Implementation object for the document.

InnerText

Gets the text from inside the XML.

LastChild

Gets the last child node.

LocalName

Gets the local name, which is the local part of a qualified name. This is called the local part in Namespaces in XML.

NamespaceUri

Returns the Uniform Resource Identifier (URI) for the namespace.

NextSibling

Gets the next sibling of the node in the parent's child list. This property is not applicable to this class.

NodeName

Returns the qualified name for attribute, document type, element, entity, or notation nodes. Returns a fixed string for all other node types.

NodeType

Gets the XML Document Object Model (DOM) node type, which determines valid values and whether the node can have child nodes.

NodeValue

Gets or sets the text associated with the node.

OwnerDocument

Returns the root of the document that contains the node.

ParentNode

Gets the parent node of the node instance.

Prefix

Gets or sets the namespace prefix.

PreviousSibling

Gets the previous sibling of the node in the parent's child list. This property is not applicable to this class.

Methods

AppendChild(IXmlNode)

Appends a new child node as the last child of the node.

CloneNode(Boolean)

Clones a new node.

CreateAttribute(String)

Creates a new attribute with the specified name.

CreateAttributeNS(Object, String)

Creates a new attribute with the specified namespace and name.

CreateCDataSection(String)

Creates a CDATA section node that contains the supplied data.

CreateComment(String)

Creates a comment node that contains the supplied data.

CreateDocumentFragment()

Creates an empty XmlDocumentFragment object.

CreateElement(String)

Creates an element node using the specified name.

CreateElementNS(Object, String)

Creates an element node using the specified namespace and name.

CreateEntityReference(String)

Creates a new XmlEntityReference object.

CreateProcessingInstruction(String, String)

Creates a processing instruction node that contains the supplied target and data.

CreateTextNode(String)

Creates a text node that contains the supplied data.

GetElementById(String)

Returns the element that matches the ID attribute.

GetElementsByTagName(String)

Returns a collection of elements that have the specified name.

GetXml()

Returns the XML representation of the node and all its descendants.

HasChildNodes()

Determines whether a node has children.

ImportNode(IXmlNode, Boolean)

Imports a node from another document to this document.

InsertBefore(IXmlNode, IXmlNode)

Inserts a child node to the left of the specified node, or at the end of the child node list.

LoadFromFileAsync(IStorageFile, XmlLoadSettings)

Asynchronously loads an XML document from the specified file. The document is parsed using the provided settings.

LoadFromFileAsync(IStorageFile)

Asynchronously loads an XML document from the specified file. The document is parsed using the default parser settings.

LoadFromUriAsync(Uri, XmlLoadSettings)

Asynchronously loads an XML document from the specified location. The document is parsed using the provided settings.

LoadFromUriAsync(Uri)

Asynchronously loads an XML document from the specified location. The document is parsed using the default parser settings.

LoadXml(String, XmlLoadSettings)

Loads an XML document using the supplied string. The document is parsed using the settings provided.

LoadXml(String)

Loads an XML document using the supplied string. The document is parsed using the default parser settings.

LoadXmlFromBuffer(IBuffer, XmlLoadSettings)

Loads an XML document using the buffer. The document is parsed using the settings provided.

LoadXmlFromBuffer(IBuffer)

Loads an XML document using the buffer. The document is parsed using the default parser settings.

Normalize()

Normalizes all descendant elements by combining two or more adjacent text nodes into one unified text node.

RemoveChild(IXmlNode)

Removes the specified child node from the list of children and returns it.

ReplaceChild(IXmlNode, IXmlNode)

Replaces the specified old child node with the supplied new child node.

SaveToFileAsync(IStorageFile)

Asynchronously saves an XML document to the specified file.

SelectNodes(String)

Applies the specified pattern-matching operation to this node's context and returns the list of matching nodes as an XmlNodeList.

SelectNodesNS(String, Object)

Applies the specified pattern-matching operation to this node's context and returns the list of matching nodes as an XmlNodeList.

SelectSingleNode(String)

Applies the specified pattern-matching operation to this node's context and returns the first matching node.

SelectSingleNodeNS(String, Object)

Applies the specified pattern-matching operation to this node's context and returns the first matching node.

Applies to

See also