The root element of the document. If the document is newly created and hasn’t been set up with a root, an XmlError will be thrown.
Set the root element of the document.
The new root. If the node is from another document, it and its subtree will be removed from the previous document.
Dispose the object.
It releases the managed resource and unregisters it from FinalizationRegistry. This ensures that the release of the managed resource doesn’t have to wait until the object is garbage collected.
To avoid resource leaks,
explicitly call the Dispose
method or use the using
declaration to declare the object.
Create the root element.
The name of the root element.
Optional
namespace: stringThe namespace of the root element.
Optional
prefix: stringThe prefix of the root node that represents the given namespace. If not provided, the given namespace will be the default.
Find all the descendant nodes of root element matching the given compiled xpath selector.
Compiled XPath selector
An empty array if the provided XPath is invalid or if no nodes are found.
Find all the descendant nodes of root element matching the given xpath selector.
XPath selector
Optional
namespaces: NamespaceMapmapping between prefix and the namespace URI, used in the XPath
An empty array if the provided XPath is invalid or if no nodes are found.
Find the first descendant node of root element matching the given compiled xpath selector.
XPath selector
null if not found, otherwise an instance of the subclass of XmlNode.
Find the first descendant node of root element matching the given xpath selector.
XPath selector
Optional
namespaces: NamespaceMapmapping between prefix and the namespace URI, used in the XPath
null if not found, otherwise an instance of the subclass of XmlNode.
Save the XmlDocument to a buffer and invoke the callbacks to process.
handlers to process the content in the buffer
Optional
options: SaveOptionsoptions to adjust the saving behavior
Save the XmlDocument to a string
Optional
options: SaveOptionsoptions to adjust the saving behavior
Static
createCreate a new document from scratch. To parse an existing xml, use fromBuffer or fromString.
Static
fromParse and create an XmlDocument from an XML buffer.
The XML buffer
Parsing options
Static
fromParse and create an XmlDocument from an XML string.
The XML string
Parsing options
The XML document.