{"title":"XmlDocument data type","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/xmldocument/xmldocument-data-type/","by":"JOP-AL","license":"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/xmldocument/xmldocument-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.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/xmldocument/xmldocument-data-type","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Represents an XML document.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Static methods","slug":"static-methods","at":88,"chars":874},{"level":2,"title":"Instance methods","slug":"instance-methods","at":962,"chars":3991},{"level":2,"title":"Related information","slug":"related-information","at":4953,"chars":117}],"text":"> Version: _Available or changed with runtime version 1.0._\nRepresents an XML document.\n## Static methods\nThe following methods are available on the XmlDocument data type.\nMethod name|Description\nxmldocument-create--method|Creates an XmlDocument.\nCreate(Any,...)<xmldocument-create-joker-method>|Creates an XmlDocument.\nReadFrom(Text, var XmlDocument)<xmldocument-readfrom-string-xmldocument-method>|Reads and parses the XML document from the given data source.\nReadFrom(Text, XmlReadOptions, var XmlDocument)<xmldocument-readfrom-string-xmlreadoptions-xmldocument-method>|Reads and parses the XML document from the given data source.\nReadFrom(InStream, var XmlDocument)<xmldocument-readfrom-instream-xmldocument-method>|Reads and parses the XML document from the given data source.\nReadFrom(InStream, XmlReadOptions, var XmlDocument)<xmldocument-readfrom-instream-xmlreadoptions-xmldocument-method>|Reads and parses the XML document from the given data source.\n## Instance methods\nThe following methods are available on instances of the XmlDocument data type.\nMethod name|Description\nAdd(Any,...)<xmldocument-add-method>|Adds the specified content as a child of this document.\nAddAfterSelf(Any,...)<xmldocument-addafterself-method>|Adds the specified content immediately after this node.\nAddBeforeSelf(Any,...)<xmldocument-addbeforeself-method>|Adds the specified content immediately before this node.\nAddFirst(Any,...)<xmldocument-addfirst-method>|Adds the specified content at the start of the child list of this document.\nxmldocument-asxmlnode-method|Converts the node to an XmlNode.\nxmldocument-getchildelements--method|Gets a list containing the child elements for this document, in document order.\nGetChildElements(Text)<xmldocument-getchildelements-string-method>|Gets a list containing the child elements for this document, in document order.\nGetChildElements(Text, Text)<xmldocument-getchildelements-string-string-method>|Gets a list containing the child elements for this document, in document order.\nxmldocument-getchildnodes-method|Gets a list containing the child elements for this document, in document order.\nGetDeclaration(var XmlDeclaration)<xmldocument-getdeclaration-method>|Gets the XML declaration for this document.\nxmldocument-getdescendantelements--method|Gets a list containing the descendant elements for this document, in document order.\nGetDescendantElements(Text)<xmldocument-getdescendantelements-string-method>|Gets a list containing the descendant elements for this document, in document order.\nGetDescendantElements(Text, Text)<xmldocument-getdescendantelements-string-string-method>|Gets a list containing the descendant elements for this document, in document order.\nxmldocument-getdescendantnodes-method|Gets a list containing the descendant nodes for this document, in document order.\nGetDocument(var XmlDocument)<xmldocument-getdocument-method>|Gets the XmlDocument for this node.\nGetDocumentType(var XmlDocumentType)<xmldocument-getdocumenttype-method>|Gets the Document Type Definition (DTD) for this document.\nGetParent(var XmlElement)<xmldocument-getparent-method>|Gets the parent XmlElement of this node.\nGetRoot(var XmlElement)<xmldocument-getroot-method>|Gets the root element of the XML tree for this document.\nxmldocument-nametable-method|Gets the XmlNameTable associated with this document.\nxmldocument-remove-method|Removes this node from its parent element.\nxmldocument-removenodes-method|Removes the child nodes from this document.\nReplaceNodes(Any,...)<xmldocument-replacenodes-method>|Replaces the children nodes of this document with the specified content.\nReplaceWith(Any,...)<xmldocument-replacewith-method>|Replaces this node with the specified content.\nSelectNodes(Text, var XmlNodeList)<xmldocument-selectnodes-string-xmlnodelist-method>|Selects a list of nodes matching the XPath expression.\nSelectNodes(Text, XmlNamespaceManager, var XmlNodeList)<xmldocument-selectnodes-string-xmlnamespacemanager-xmlnodelist-method>|Selects a list of nodes matching the XPath expression.\nSelectSingleNode(Text, var XmlNode)<xmldocument-selectsinglenode-string-xmlnode-method>|Selects the first XmlNode that matches the XPath expression.\nSelectSingleNode(Text, XmlNamespaceManager, var XmlNode)<xmldocument-selectsinglenode-string-xmlnamespacemanager-xmlnode-method>|Selects the first XmlNode that matches the XPath expression.\nSetDeclaration(XmlDeclaration)<xmldocument-setdeclaration-method>|Sets the XML declaration for this document.\nxmldocument-writeto-outstream-method|Serializes and saves the current node to the given variable.\nxmldocument-writeto-xmlwriteoptions-outstream-method|Serializes and saves the current node to the given variable.\nWriteTo(var Text)<xmldocument-writeto-text-method>|Serializes and saves the current node to the given variable.\nWriteTo(XmlWriteOptions, var Text)<xmldocument-writeto-xmlwriteoptions-text-method>|Serializes and saves the current node to the given variable.\n## Related information\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}