XmlDocument XmlDocument XmlDocument XmlDocument Class

Definition

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

public : sealed class XmlDocument : IXmlDocument, IXmlDocumentIO, IXmlDocumentIO2, IXmlNode, IXmlNodeSelector, IXmlNodeSerializer
public sealed class XmlDocument : IXmlDocument, IXmlDocumentIO, IXmlDocumentIO2, IXmlNode, IXmlNodeSelector, IXmlNodeSerializer
Public NotInheritable Class XmlDocument Implements IXmlDocument, IXmlDocumentIO, IXmlDocumentIO2, IXmlNode, IXmlNodeSelector, IXmlNodeSerializer
var xmlDocument = new xmlDocument();
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Constructors

XmlDocument() XmlDocument() XmlDocument() XmlDocument()

Creates a new instance of the XmlDocument class.

public : XmlDocument()
public XmlDocument()
Public Sub New()
var xmlDocument = new xmlDocument();

Properties

Attributes Attributes Attributes Attributes

Gets the list of attributes of this node.

public : XmlNamedNodeMap Attributes { get; }
public XmlNamedNodeMap Attributes { get; }
Public ReadOnly Property Attributes As XmlNamedNodeMap
var xmlNamedNodeMap = xmlDocument.attributes;
Value
XmlNamedNodeMap XmlNamedNodeMap XmlNamedNodeMap XmlNamedNodeMap

The attributes for this node.

ChildNodes ChildNodes ChildNodes ChildNodes

Gets a list of children in the current node.

public : XmlNodeList ChildNodes { get; }
public XmlNodeList ChildNodes { get; }
Public ReadOnly Property ChildNodes As XmlNodeList
var xmlNodeList = xmlDocument.childNodes;
Value
XmlNodeList XmlNodeList XmlNodeList XmlNodeList

The list of child nodes.

Doctype Doctype Doctype Doctype

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

public : XmlDocumentType Doctype { get; }
public XmlDocumentType Doctype { get; }
Public ReadOnly Property Doctype As XmlDocumentType
var xmlDocumentType = xmlDocument.doctype;

DocumentElement DocumentElement DocumentElement DocumentElement

Gets the root element of the document.

public : XmlElement DocumentElement { get; }
public XmlElement DocumentElement { get; }
Public ReadOnly Property DocumentElement As XmlElement
var xmlElement = xmlDocument.documentElement;
Value
XmlElement XmlElement XmlElement XmlElement

The root element of the document.

DocumentUri DocumentUri DocumentUri DocumentUri

Returns the URL for the last loaded XML document.

public : Platform::String DocumentUri { get; }
public string DocumentUri { get; }
Public ReadOnly Property DocumentUri As string
var string = xmlDocument.documentUri;
Value
Platform::String string string string

The URL for the last loaded XML document.

FirstChild FirstChild FirstChild FirstChild

Gets the first child node.

public : IXmlNode FirstChild { get; }
public IXmlNode FirstChild { get; }
Public ReadOnly Property FirstChild As IXmlNode
var iXmlNode = xmlDocument.firstChild;
Value
IXmlNode IXmlNode IXmlNode IXmlNode

The first child node. This property returns NULL if there are no children.

Implementation Implementation Implementation Implementation

Gets the Implementation object for the document.

public : XmlDomImplementation Implementation { get; }
public XmlDomImplementation Implementation { get; }
Public ReadOnly Property Implementation As XmlDomImplementation
var xmlDomImplementation = xmlDocument.implementation;
Value
XmlDomImplementation XmlDomImplementation XmlDomImplementation XmlDomImplementation

The Implementation object for the document.

InnerText InnerText InnerText InnerText

Gets the text from inside the XML.

public : Platform::String InnerText { get; set; }
public string InnerText { get; set; }
Public ReadWrite Property InnerText As string
var string = xmlDocument.innerText;
xmlDocument.innerText = string;
Value
Platform::String string string string

The text from inside the XML. Returns an empty string if there is no text.

LastChild LastChild LastChild LastChild

Gets the last child node.

public : IXmlNode LastChild { get; }
public IXmlNode LastChild { get; }
Public ReadOnly Property LastChild As IXmlNode
var iXmlNode = xmlDocument.lastChild;
Value
IXmlNode IXmlNode IXmlNode IXmlNode

The last child node. This property is NULL if there are no children.

LocalName LocalName LocalName LocalName

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

public : Platform::Object LocalName { get; }
public object LocalName { get; }
Public ReadOnly Property LocalName As object
var object = xmlDocument.localName;
Value
Platform::Object object object object

The local name.

NamespaceUri NamespaceUri NamespaceUri NamespaceUri

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

public : Platform::Object NamespaceUri { get; }
public object NamespaceUri { get; }
Public ReadOnly Property NamespaceUri As object
var object = xmlDocument.namespaceUri;
Value
Platform::Object object object object

The Uri for the namespace. This refers to the "uuu" portion of the namespace declaration xmlns:nnn="uuu".

NextSibling NextSibling NextSibling NextSibling

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

public : IXmlNode NextSibling { get; }
public IXmlNode NextSibling { get; }
Public ReadOnly Property NextSibling As IXmlNode
var iXmlNode = xmlDocument.nextSibling;
Value
IXmlNode IXmlNode IXmlNode IXmlNode

The right sibling of this node.

NodeName NodeName NodeName NodeName

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

public : Platform::String NodeName { get; }
public string NodeName { get; }
Public ReadOnly Property NodeName As string
var string = xmlDocument.nodeName;
Value
Platform::String string string string

The qualified node name, which varies depending on the node type.

NodeType NodeType NodeType NodeType

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

public : NodeType NodeType { get; }
public NodeType NodeType { get; }
Public ReadOnly Property NodeType As NodeType
var nodeType = xmlDocument.nodeType;
Value
NodeType NodeType NodeType NodeType

The node type.

NodeValue NodeValue NodeValue NodeValue

Gets or sets the text associated with the node.

public : Platform::Object NodeValue { get; set; }
public object NodeValue { get; set; }
Public ReadWrite Property NodeValue As object
var object = xmlDocument.nodeValue;
xmlDocument.nodeValue = object;
Value
Platform::Object object object object

The text associated with the node.

Remarks

This value depends on the NodeType property. The following table describes this dependency.

NodeTypeNodeValue
ElementNull
AttributeValue of attribute
TextContent of the text node
CDATASectionContent of the CDATA Section
EntityReferenceNULL
EntityNULL
ProcessingInstructionEntire content excluding the target
CommentContent of the comment
DocumentNULL
DocumentTypeNULL
DocumentFragmentNULL
NotationNULL

OwnerDocument OwnerDocument OwnerDocument OwnerDocument

Returns the root of the document that contains the node.

public : XmlDocument OwnerDocument { get; }
public XmlDocument OwnerDocument { get; }
Public ReadOnly Property OwnerDocument As XmlDocument
var xmlDocument = xmlDocument.ownerDocument;
Value
XmlDocument XmlDocument XmlDocument XmlDocument

The parent document that represents the root of the document.

ParentNode ParentNode ParentNode ParentNode

Gets the parent node of the node instance.

public : IXmlNode ParentNode { get; }
public IXmlNode ParentNode { get; }
Public ReadOnly Property ParentNode As IXmlNode
var iXmlNode = xmlDocument.parentNode;
Value
IXmlNode IXmlNode IXmlNode IXmlNode

This property returns NULL.

Prefix Prefix Prefix Prefix

Gets or sets the namespace prefix.

public : Platform::Object Prefix { get; set; }
public object Prefix { get; set; }
Public ReadWrite Property Prefix As object
var object = xmlDocument.prefix;
xmlDocument.prefix = object;
Value
Platform::Object object object object

The namespace prefix specified on the element, attribute, or entity reference. For example, for the element <xxx:yyy>, this property returns xxx. It returns an empty string, "", if no prefix is specified.

PreviousSibling PreviousSibling PreviousSibling PreviousSibling

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

public : IXmlNode PreviousSibling { get; }
public IXmlNode PreviousSibling { get; }
Public ReadOnly Property PreviousSibling As IXmlNode
var iXmlNode = xmlDocument.previousSibling;
Value
IXmlNode IXmlNode IXmlNode IXmlNode

The left sibling of this node.

Methods

AppendChild(IXmlNode) AppendChild(IXmlNode) AppendChild(IXmlNode) AppendChild(IXmlNode)

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

public : IXmlNode AppendChild(IXmlNode newChild)
public IXmlNode AppendChild(IXmlNode newChild)
Public Function AppendChild(newChild As IXmlNode) As IXmlNode
var iXmlNode = xmlDocument.appendChild(newChild);
Parameters
newChild
IXmlNode IXmlNode IXmlNode IXmlNode

The new child node to be appended to the end of the list of children of this node.

Returns

The new child node successfully appended to the list. If null, no object is created.

CloneNode(Boolean) CloneNode(Boolean) CloneNode(Boolean) CloneNode(Boolean)

Clones a new node.

public : IXmlNode CloneNode(bool deep)
public IXmlNode CloneNode(Boolean deep)
Public Function CloneNode(deep As Boolean) As IXmlNode
var iXmlNode = xmlDocument.cloneNode(deep);
Parameters
deep
bool Boolean Boolean Boolean

A flag that indicates whether to recursively clone all nodes that are descendants of this node. If true, this method creates a clone of the complete tree below this node. If false, this method clones this node and its attributes only.

Returns

The newly created clone node.

CreateAttribute(String) CreateAttribute(String) CreateAttribute(String) CreateAttribute(String)

Creates a new attribute with the specified name.

public : XmlAttribute CreateAttribute(Platform::String name)
public XmlAttribute CreateAttribute(String name)
Public Function CreateAttribute(name As String) As XmlAttribute
var xmlAttribute = xmlDocument.createAttribute(name);
Parameters
name
Platform::String String String String

The name of the new attribute object. This name is subsequently available as the new node's NodeName property.

Returns

The newly created attribute.

CreateAttributeNS(Object, String) CreateAttributeNS(Object, String) CreateAttributeNS(Object, String) CreateAttributeNS(Object, String)

Creates a new attribute with the specified namespace and name.

public : XmlAttribute CreateAttributeNS(Platform::Object namespaceUri, Platform::String qualifiedName)
public XmlAttribute CreateAttributeNS(Object namespaceUri, String qualifiedName)
Public Function CreateAttributeNS(namespaceUri As Object, qualifiedName As String) As XmlAttribute
var xmlAttribute = xmlDocument.createAttributeNS(namespaceUri, qualifiedName);
Parameters
namespaceUri
Platform::Object Object Object Object

The name of the desired namespace or a null value if no namespace is desired.

qualifiedName
Platform::String String String String

The name of the new attribute object. This name is subsequently available as the new node's NodeName property.

Returns

The newly created attribute.

CreateCDataSection(String) CreateCDataSection(String) CreateCDataSection(String) CreateCDataSection(String)

Creates a CDATA section node that contains the supplied data.

public : XmlCDataSection CreateCDataSection(Platform::String data)
public XmlCDataSection CreateCDataSection(String data)
Public Function CreateCDataSection(data As String) As XmlCDataSection
var xmlcDataSection = xmlDocument.createcDataSection(data);
Parameters
data
Platform::String String String String

The value to be supplied to the new CDATA section object's NodeValue property.

Returns

CreateComment(String) CreateComment(String) CreateComment(String) CreateComment(String)

Creates a comment node that contains the supplied data.

public : XmlComment CreateComment(Platform::String data)
public XmlComment CreateComment(String data)
Public Function CreateComment(data As String) As XmlComment
var xmlComment = xmlDocument.createComment(data);
Parameters
data
Platform::String String String String

The value to be supplied to the new comment object's NodeValue.

Returns

The newly created comment node.

CreateDocumentFragment() CreateDocumentFragment() CreateDocumentFragment() CreateDocumentFragment()

Creates an empty XmlDocumentFragment object.

public : XmlDocumentFragment CreateDocumentFragment()
public XmlDocumentFragment CreateDocumentFragment()
Public Function CreateDocumentFragment() As XmlDocumentFragment
var xmlDocumentFragment = xmlDocument.createDocumentFragment();
Returns

CreateElement(String) CreateElement(String) CreateElement(String) CreateElement(String)

Creates an element node using the specified name.

public : XmlElement CreateElement(Platform::String tagName)
public XmlElement CreateElement(String tagName)
Public Function CreateElement(tagName As String) As XmlElement
var xmlElement = xmlDocument.createElement(tagName);
Parameters
tagName
Platform::String String String String

The name for the new element node. The string is case-sensitive. This name is subsequently available as the element node's NodeName property.

Returns

The newly created object.

CreateElementNS(Object, String) CreateElementNS(Object, String) CreateElementNS(Object, String) CreateElementNS(Object, String)

Creates an element node using the specified namespace and name.

public : XmlElement CreateElementNS(Platform::Object namespaceUri, Platform::String qualifiedName)
public XmlElement CreateElementNS(Object namespaceUri, String qualifiedName)
Public Function CreateElementNS(namespaceUri As Object, qualifiedName As String) As XmlElement
var xmlElement = xmlDocument.createElementNS(namespaceUri, qualifiedName);
Parameters
namespaceUri
Platform::Object Object Object Object

The name of the desired namespace or a null value if no namespace is desired.

qualifiedName
Platform::String String String String

The name for the new element node. It is case-sensitive. This name is subsequently available as the element node's NodeName property.

Returns

The newly created object.

CreateEntityReference(String) CreateEntityReference(String) CreateEntityReference(String) CreateEntityReference(String)

Creates a new XmlEntityReference object.

public : XmlEntityReference CreateEntityReference(Platform::String name)
public XmlEntityReference CreateEntityReference(String name)
Public Function CreateEntityReference(name As String) As XmlEntityReference
var xmlEntityReference = xmlDocument.createEntityReference(name);
Parameters
name
Platform::String String String String

The name of the entity referenced. This name is subsequently available as the new object's NodeName property.

Returns

CreateProcessingInstruction(String, String) CreateProcessingInstruction(String, String) CreateProcessingInstruction(String, String) CreateProcessingInstruction(String, String)

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

public : XmlProcessingInstruction CreateProcessingInstruction(Platform::String target, Platform::String data)
public XmlProcessingInstruction CreateProcessingInstruction(String target, String data)
Public Function CreateProcessingInstruction(target As String, data As String) As XmlProcessingInstruction
var xmlProcessingInstruction = xmlDocument.createProcessingInstruction(target, data);
Parameters
target
Platform::String String String String

The target part of the processing instruction. It supplies the NodeName property of the new object.

data
Platform::String String String String

The remainder of the processing instruction preceding the closing** ?>** characters. It supplies the NodeValue property for the new object.

Returns

CreateTextNode(String) CreateTextNode(String) CreateTextNode(String) CreateTextNode(String)

Creates a text node that contains the supplied data.

public : XmlText CreateTextNode(Platform::String data)
public XmlText CreateTextNode(String data)
Public Function CreateTextNode(data As String) As XmlText
var xmlText = xmlDocument.createTextNode(data);
Parameters
data
Platform::String String String String

The value to be supplied to the new text object's NodeValue.

Returns

The created text node.

GetElementById(String) GetElementById(String) GetElementById(String) GetElementById(String)

Returns the element that matches the ID attribute.

public : XmlElement GetElementById(Platform::String elementId)
public XmlElement GetElementById(String elementId)
Public Function GetElementById(elementId As String) As XmlElement
var xmlElement = xmlDocument.getElementById(elementId);
Parameters
elementId
Platform::String String String String

The ID to match.

Returns

The element that matches the supplied ID. If no elements match, this method returns Null.

GetElementsByTagName(String) GetElementsByTagName(String) GetElementsByTagName(String) GetElementsByTagName(String)

Returns a collection of elements that have the specified name.

public : XmlNodeList GetElementsByTagName(Platform::String tagName)
public XmlNodeList GetElementsByTagName(String tagName)
Public Function GetElementsByTagName(tagName As String) As XmlNodeList
var xmlNodeList = xmlDocument.getElementsByTagName(tagName);
Parameters
tagName
Platform::String String String String

The element name to find. The value "*" returns all elements in the document.

Returns

The collection of elements that match the specified name.

GetXml() GetXml() GetXml() GetXml()

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

public : Platform::String GetXml()
public string GetXml()
Public Function GetXml() As string
var string = xmlDocument.getXml();
Returns
Platform::String string string string

The XML representation of the node and all its descendants.

HasChildNodes() HasChildNodes() HasChildNodes() HasChildNodes()

Determines whether a node has children.

public : Platform::Boolean HasChildNodes()
public bool HasChildNodes()
Public Function HasChildNodes() As bool
var bool = xmlDocument.hasChildNodes();
Returns
Platform::Boolean bool bool bool

True if this node has children; otherwise false.

ImportNode(IXmlNode, Boolean) ImportNode(IXmlNode, Boolean) ImportNode(IXmlNode, Boolean) ImportNode(IXmlNode, Boolean)

Imports a node from another document to this document.

public : IXmlNode ImportNode(IXmlNode node, bool deep)
public IXmlNode ImportNode(IXmlNode node, Boolean deep)
Public Function ImportNode(node As IXmlNode, deep As Boolean) As IXmlNode
var iXmlNode = xmlDocument.importNode(node, deep);
Parameters
node
IXmlNode IXmlNode IXmlNode IXmlNode

The object to be cloned.

deep
bool Boolean Boolean Boolean

If true, any children of node will be cloned as well. If false, no children of the node will be cloned.

Returns

The imported node.

Remarks

The returned node has no parent (the is null). The source node is not altered or removed from the original document; this method creates a new copy of the source node.

InsertBefore(IXmlNode, IXmlNode) InsertBefore(IXmlNode, IXmlNode) InsertBefore(IXmlNode, IXmlNode) InsertBefore(IXmlNode, IXmlNode)

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

public : IXmlNode InsertBefore(IXmlNode newChild, IXmlNode referenceChild)
public IXmlNode InsertBefore(IXmlNode newChild, IXmlNode referenceChild)
Public Function InsertBefore(newChild As IXmlNode, referenceChild As IXmlNode) As IXmlNode
var iXmlNode = xmlDocument.insertBefore(newChild, referenceChild);
Parameters
newChild
IXmlNode IXmlNode IXmlNode IXmlNode

The address of the new node to be inserted. The node passed here must be a valid child of the current XML DOM document node. For example, if the current node is an attribute, you cannot pass another attribute in the newChild parameter, because an attribute cannot have an attribute as a child. If newChild is a DOCUMENT_FRAGMENT node type, all its children are inserted in order before referenceChild.

If newChild is already in the tree, it is first removed before it is reinserted before the referenceChild node. Read-only nodes, such as NODE_DOCUMENT_TYPE and NODE_ENTITY nodes, cannot be passed in the newChild parameter.

referenceChild
IXmlNode IXmlNode IXmlNode IXmlNode

The reference node. The node specified is where the newChild node is to be inserted to the left as the preceding sibling in the child list. The node passed here must be a either a child node of the current node or null. If the value is null, the newChild node is inserted at the end of the child list. If the referenceChild node is not a child of the current node, an error is returned.

Returns

On success, the child node that was inserted. If null, no object is created.

LoadFromFileAsync(IStorageFile) LoadFromFileAsync(IStorageFile) LoadFromFileAsync(IStorageFile) LoadFromFileAsync(IStorageFile)

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

public : static IAsyncOperation<XmlDocument> LoadFromFileAsync(IStorageFile file)
public static IAsyncOperation<XmlDocument> LoadFromFileAsync(IStorageFile file)
Public Static Function LoadFromFileAsync(file As IStorageFile) As IAsyncOperation( Of XmlDocument )
Windows.Data.Xml.Dom.XmlDocument.loadFromFileAsync(file).done( /* Your success and error handlers */ );
Parameters
file
IStorageFile IStorageFile IStorageFile IStorageFile

The file from which to load the document.

Returns
See Also

LoadFromFileAsync(IStorageFile, XmlLoadSettings) LoadFromFileAsync(IStorageFile, XmlLoadSettings) LoadFromFileAsync(IStorageFile, XmlLoadSettings) LoadFromFileAsync(IStorageFile, XmlLoadSettings)

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

public : static IAsyncOperation<XmlDocument> LoadFromFileAsync(IStorageFile file, XmlLoadSettings loadSettings)
public static IAsyncOperation<XmlDocument> LoadFromFileAsync(IStorageFile file, XmlLoadSettings loadSettings)
Public Static Function LoadFromFileAsync(file As IStorageFile, loadSettings As XmlLoadSettings) As IAsyncOperation( Of XmlDocument )
Windows.Data.Xml.Dom.XmlDocument.loadFromFileAsync(file, loadSettings).done( /* Your success and error handlers */ );
Parameters
file
IStorageFile IStorageFile IStorageFile IStorageFile

The file from which to load the document.

loadSettings
XmlLoadSettings XmlLoadSettings XmlLoadSettings XmlLoadSettings

Settings for customizing parser behavior.

Returns
See Also

LoadFromUriAsync(Uri) LoadFromUriAsync(Uri) LoadFromUriAsync(Uri) LoadFromUriAsync(Uri)

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

public : static IAsyncOperation<XmlDocument> LoadFromUriAsync(Uri uri)
public static IAsyncOperation<XmlDocument> LoadFromUriAsync(Uri uri)
Public Static Function LoadFromUriAsync(uri As Uri) As IAsyncOperation( Of XmlDocument )
Windows.Data.Xml.Dom.XmlDocument.loadFromUriAsync(uri).done( /* Your success and error handlers */ );
Parameters
uri
Uri Uri Uri Uri

A URL that specifies the location of the XML file.

Returns
See Also

LoadFromUriAsync(Uri, XmlLoadSettings) LoadFromUriAsync(Uri, XmlLoadSettings) LoadFromUriAsync(Uri, XmlLoadSettings) LoadFromUriAsync(Uri, XmlLoadSettings)

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

public : static IAsyncOperation<XmlDocument> LoadFromUriAsync(Uri uri, XmlLoadSettings loadSettings)
public static IAsyncOperation<XmlDocument> LoadFromUriAsync(Uri uri, XmlLoadSettings loadSettings)
Public Static Function LoadFromUriAsync(uri As Uri, loadSettings As XmlLoadSettings) As IAsyncOperation( Of XmlDocument )
Windows.Data.Xml.Dom.XmlDocument.loadFromUriAsync(uri, loadSettings).done( /* Your success and error handlers */ );
Parameters
uri
Uri Uri Uri Uri

A URL that specifies the location of the XML file.

loadSettings
XmlLoadSettings XmlLoadSettings XmlLoadSettings XmlLoadSettings

Customizes parser behavior.

Returns

Remarks

This operation does not start until a call is made to the IAsyncOperation::StartOperation method.

See Also

LoadXml(String) LoadXml(String) LoadXml(String) LoadXml(String)

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

public : void LoadXml(Platform::String xml)
public void LoadXml(String xml)
Public Function LoadXml(xml As String) As void
xmlDocument.loadXml(xml);
Parameters
xml
Platform::String String String String

The XML string to load into this XML document object. This string can contain an entire XML document or a well-formed fragment.

See Also

LoadXml(String, XmlLoadSettings) LoadXml(String, XmlLoadSettings) LoadXml(String, XmlLoadSettings) LoadXml(String, XmlLoadSettings)

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

public : void LoadXml(Platform::String xml, XmlLoadSettings loadSettings)
public void LoadXml(String xml, XmlLoadSettings loadSettings)
Public Function LoadXml(xml As String, loadSettings As XmlLoadSettings) As void
xmlDocument.loadXml(xml, loadSettings);
Parameters
xml
Platform::String String String String

The XML string to load into this XML document object. This string can contain an entire XML document or a well-formed fragment.

loadSettings
XmlLoadSettings XmlLoadSettings XmlLoadSettings XmlLoadSettings

The settings for parsing the document.

See Also

LoadXmlFromBuffer(IBuffer) LoadXmlFromBuffer(IBuffer) LoadXmlFromBuffer(IBuffer) LoadXmlFromBuffer(IBuffer)

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

public : void LoadXmlFromBuffer(IBuffer buffer)
public void LoadXmlFromBuffer(IBuffer buffer)
Public Function LoadXmlFromBuffer(buffer As IBuffer) As void
xmlDocument.loadXmlFromBuffer(buffer);
Parameters
buffer
IBuffer IBuffer IBuffer IBuffer

The buffer to load into this XML document object. This buffer can contain an entire XML document or a well-formed fragment.

See Also

LoadXmlFromBuffer(IBuffer, XmlLoadSettings) LoadXmlFromBuffer(IBuffer, XmlLoadSettings) LoadXmlFromBuffer(IBuffer, XmlLoadSettings) LoadXmlFromBuffer(IBuffer, XmlLoadSettings)

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

public : void LoadXmlFromBuffer(IBuffer buffer, XmlLoadSettings loadSettings)
public void LoadXmlFromBuffer(IBuffer buffer, XmlLoadSettings loadSettings)
Public Function LoadXmlFromBuffer(buffer As IBuffer, loadSettings As XmlLoadSettings) As void
xmlDocument.loadXmlFromBuffer(buffer, loadSettings);
Parameters
buffer
IBuffer IBuffer IBuffer IBuffer

The buffer to load into this XML document object. This buffer can contain an entire XML document or a well-formed fragment.

loadSettings
XmlLoadSettings XmlLoadSettings XmlLoadSettings XmlLoadSettings

The settings for parsing the document.

See Also

Normalize() Normalize() Normalize() Normalize()

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

public : void Normalize()
public void Normalize()
Public Function Normalize() As void
xmlDocument.normalize();

RemoveChild(IXmlNode) RemoveChild(IXmlNode) RemoveChild(IXmlNode) RemoveChild(IXmlNode)

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

public : IXmlNode RemoveChild(IXmlNode childNode)
public IXmlNode RemoveChild(IXmlNode childNode)
Public Function RemoveChild(childNode As IXmlNode) As IXmlNode
var iXmlNode = xmlDocument.removeChild(childNode);
Parameters
childNode
IXmlNode IXmlNode IXmlNode IXmlNode

The child node to be removed from the list of children of this node.

Returns

The removed child node. If null, the childNode object is not removed.

ReplaceChild(IXmlNode, IXmlNode) ReplaceChild(IXmlNode, IXmlNode) ReplaceChild(IXmlNode, IXmlNode) ReplaceChild(IXmlNode, IXmlNode)

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

public : IXmlNode ReplaceChild(IXmlNode newChild, IXmlNode referenceChild)
public IXmlNode ReplaceChild(IXmlNode newChild, IXmlNode referenceChild)
Public Function ReplaceChild(newChild As IXmlNode, referenceChild As IXmlNode) As IXmlNode
var iXmlNode = xmlDocument.replaceChild(newChild, referenceChild);
Parameters
newChild
IXmlNode IXmlNode IXmlNode IXmlNode

The new child that is to replace the old child. If null, the referenceChild parameter is removed without a replacement.

referenceChild
IXmlNode IXmlNode IXmlNode IXmlNode

The old child that is to be replaced by the new child.

Returns

The old child that is replaced. If null, no object is created.

SaveToFileAsync(IStorageFile) SaveToFileAsync(IStorageFile) SaveToFileAsync(IStorageFile) SaveToFileAsync(IStorageFile)

Asynchronously saves an XML document to the specified file.

public : IAsyncAction SaveToFileAsync(IStorageFile file)
public IAsyncAction SaveToFileAsync(IStorageFile file)
Public Function SaveToFileAsync(file As IStorageFile) As IAsyncAction
Windows.Data.Xml.Dom.XmlDocument.saveToFileAsync(file).done( /* Your success and error handlers */ );
Parameters
file
IStorageFile IStorageFile IStorageFile IStorageFile

The file to save the document to.

Returns

The object that must be used to start the operation.

SelectNodes(String) SelectNodes(String) SelectNodes(String) SelectNodes(String)

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

public : XmlNodeList SelectNodes(Platform::String xpath)
public XmlNodeList SelectNodes(String xpath)
Public Function SelectNodes(xpath As String) As XmlNodeList
var xmlNodeList = xmlDocument.selectNodes(xpath);
Parameters
xpath
Platform::String String String String

Specifies an XPath expression.

Returns

The collection of nodes selected by applying the given pattern-matching operation. If no nodes are selected, this method returns an empty collection.

SelectNodesNS(String, Object) SelectNodesNS(String, Object) SelectNodesNS(String, Object) SelectNodesNS(String, Object)

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

public : XmlNodeList SelectNodesNS(Platform::String xpath, Platform::Object namespaces)
public XmlNodeList SelectNodesNS(String xpath, Object namespaces)
Public Function SelectNodesNS(xpath As String, namespaces As Object) As XmlNodeList
var xmlNodeList = xmlDocument.selectNodesNS(xpath, namespaces);
Parameters
xpath
Platform::String String String String

Specifies an XPath expression.

namespaces
Platform::Object Object Object Object

Contains a string that specifies namespaces for use in XPath expressions when it is necessary to define new namespaces externally. Namespaces are defined in the XML style, as a space-separated list of namespace declaration attributes. You can use this property to set the default namespace as well.

Returns

The collection of nodes selected by applying the given pattern-matching operation. If no nodes are selected, returns an empty collection.

Remarks

Prefixes in the query are resolved using the specified namespace declarations.

SelectSingleNode(String) SelectSingleNode(String) SelectSingleNode(String) SelectSingleNode(String)

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

public : IXmlNode SelectSingleNode(Platform::String xpath)
public IXmlNode SelectSingleNode(String xpath)
Public Function SelectSingleNode(xpath As String) As IXmlNode
var iXmlNode = xmlDocument.selectSingleNode(xpath);
Parameters
xpath
Platform::String String String String

Specifies an XPath expression.

Returns

The first node that matches the given pattern-matching operation. If no nodes match the expression, the method returns a null value.

SelectSingleNodeNS(String, Object) SelectSingleNodeNS(String, Object) SelectSingleNodeNS(String, Object) SelectSingleNodeNS(String, Object)

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

public : IXmlNode SelectSingleNodeNS(Platform::String xpath, Platform::Object namespaces)
public IXmlNode SelectSingleNodeNS(String xpath, Object namespaces)
Public Function SelectSingleNodeNS(xpath As String, namespaces As Object) As IXmlNode
var iXmlNode = xmlDocument.selectSingleNodeNS(xpath, namespaces);
Parameters
xpath
Platform::String String String String

Specifies an XPath expression.

namespaces
Platform::Object Object Object Object

Contains a string that specifies the namespaces to use in XPath expressions when it is necessary to define new namespaces externally. Namespaces are defined in the XML style, as a space-separated list of namespace declaration attributes. You can use this property to set the default namespace as well.

Returns

The first node that matches the given pattern-matching operation. If no nodes match the expression, this method returns a null value.

Remarks

Prefixes in the query are resolved using the specified namespace declarations.

See Also