# XmlNode data type
> Version: _Available or changed with runtime version 1.0._
Represents a XML node which can either be for instance an XML attribute, an XML element or a XML document.
## Instance methods
The following methods are available on instances of the XmlNode data type.
Method name|Description
AddAfterSelf(Any,...)<xmlnode-addafterself-method>|Adds the specified content immediately after this node.
AddBeforeSelf(Any,...)<xmlnode-addbeforeself-method>|Adds the specified content immediately before this node.
xmlnode-asxmlattribute-method|Converts the node to an XmlAttribute node. The operation will fail if the node is not an XmlAttribute.
xmlnode-asxmlcdata-method|Converts the node to an XmlCData node. The operation will fail if the node is not an XmlCData.
xmlnode-asxmlcomment-method|Converts the node to an XmlComment node. The operation will fail if the node is not an XmlComment.
xmlnode-asxmldeclaration-method|Converts the node to an XmlDeclaration node. The operation will fail if the node is not an XmlDeclaration.
xmlnode-asxmldocument-method|Converts the node to an XmlDocument node. The operation will fail if the node is not an XmlDocument.
xmlnode-asxmldocumenttype-method|Converts the node to an XmlDocumentType node. The operation will fail if the node is not an XmlDocumentType.
xmlnode-asxmlelement-method|Converts the node to an XmlElement node. The operation will fail if the node is not an XmlElement.
xmlnode-asxmlprocessinginstruction-method|Converts the node to an XmlProcessingInstruction node. The operation will fail if the node is not an XmlProcessingInstruction.
xmlnode-asxmltext-method|Converts the node to an XmlText node. The operation will fail if the node is not an XmlText.
GetDocument(var XmlDocument)<xmlnode-getdocument-method>|Gets the XmlDocument for this node.
GetParent(var XmlElement)<xmlnode-getparent-method>|Gets the parent XmlElement of this node.
xmlnode-isxmlattribute-method|Gets a value indicating whether this node is an XmlAttribute.
xmlnode-isxmlcdata-method|Gets a value indicating whether this node is an XmlCData.
xmlnode-isxmlcomment-method|Gets a value indicating whether this node is an XmlComment.
xmlnode-isxmldeclaration-method|Gets a value indicating whether this node is an XmlDeclaration.
xmlnode-isxmldocument-method|Gets a value indicating whether this node is an XmlDocument.
xmlnode-isxmldocumenttype-method|Gets a value indicating whether this node is an XmlDocumentType.
xmlnode-isxmlelement-method|Gets a value indicating whether this node is an XmlElement.
xmlnode-isxmlprocessinginstruction-method|Gets a value indicating whether this node is an XmlProcessingInstruction.
xmlnode-isxmltext-method|Gets a value indicating whether this node is an XmlText.
xmlnode-remove-method|Removes this node from its parent element.
ReplaceWith(Any,...)<xmlnode-replacewith-method>|Replaces this node with the specified content.
SelectNodes(Text, var XmlNodeList)<xmlnode-selectnodes-string-xmlnodelist-method>|Selects a list of nodes matching the XPath expression.
SelectNodes(Text, XmlNamespaceManager, var XmlNodeList)<xmlnode-selectnodes-string-xmlnamespacemanager-xmlnodelist-method>|Selects a list of nodes matching the XPath expression.
SelectSingleNode(Text, var XmlNode)<xmlnode-selectsinglenode-string-xmlnode-method>|Selects the first XmlNode that matches the XPath expression.
SelectSingleNode(Text, XmlNamespaceManager, var XmlNode)<xmlnode-selectsinglenode-string-xmlnamespacemanager-xmlnode-method>|Selects the first XmlNode that matches the XPath expression.
xmlnode-writeto-outstream-method|Serializes and saves the current node to the given variable.
xmlnode-writeto-xmlwriteoptions-outstream-method|Serializes and saves the current node to the given variable.
WriteTo(var Text)<xmlnode-writeto-text-method>|Serializes and saves the current node to the given variable.
WriteTo(XmlWriteOptions, var Text)<xmlnode-writeto-xmlwriteoptions-text-method>|Serializes and saves the current node to the given variable.
## Related information
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/xmlnode/xmlnode-data-type, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/xmlnode/xmlnode-data-type/
