# XmlElement data type
> Version: _Available or changed with runtime version 1.0._
Represents an XML element.
## Static methods
The following methods are available on the XmlElement data type.
Method name|Description
Create(Text)<xmlelement-create-string-method>|Creates an XmlElement node.
Create(Text, Text)<xmlelement-create-string-string-method>|Creates an XmlElement node.
Create(Text, Text, Any,...)<xmlelement-create-string-string-joker-method>|Creates an XmlElement node.
Create(Text, Any,...)<xmlelement-create-string-joker-method>|Creates an XmlElement node.
## Instance methods
The following methods are available on instances of the XmlElement data type.
Method name|Description
Add(Any,...)<xmlelement-add-method>|Adds the specified content as a child of this element.
AddAfterSelf(Any,...)<xmlelement-addafterself-method>|Adds the specified content immediately after this node.
AddBeforeSelf(Any,...)<xmlelement-addbeforeself-method>|Adds the specified content immediately before this node.
AddFirst(Any,...)<xmlelement-addfirst-method>|Adds the specified content at the start of the child list of this element.
xmlelement-asxmlnode-method|Converts the node to an XmlNode.
xmlelement-attributes-method|Gets a collection of the attributes of this element.
xmlelement-getchildelements--method|Gets a list containing the child elements for this element, in document order.
GetChildElements(Text)<xmlelement-getchildelements-string-method>|Gets a list containing the child elements for this element, in document order.
GetChildElements(Text, Text)<xmlelement-getchildelements-string-string-method>|Gets a list containing the child elements for this element, in document order.
xmlelement-getchildnodes-method|Gets a list containing the child elements for this element, in document order.
xmlelement-getdescendantelements--method|Gets a list containing the descendant elements for this element, in document order.
GetDescendantElements(Text)<xmlelement-getdescendantelements-string-method>|Gets a list containing the descendant elements for this element, in document order.
GetDescendantElements(Text, Text)<xmlelement-getdescendantelements-string-string-method>|Gets a list containing the descendant elements for this element, in document order.
xmlelement-getdescendantnodes-method|Gets a list containing the descendant nodes for this element, in document order.
GetDocument(var XmlDocument)<xmlelement-getdocument-method>|Gets the XmlDocument for this node.
GetNamespaceOfPrefix(Text, var Text)<xmlelement-getnamespaceofprefix-method>|Gets the namespace associated with a particular prefix for this element.
GetParent(var XmlElement)<xmlelement-getparent-method>|Gets the parent XmlElement of this node.
GetPrefixOfNamespace(Text, var Text)<xmlelement-getprefixofnamespace-method>|Gets the prefix associated with a namespace URI for this element.
xmlelement-hasattributes-method|Gets a boolean value indicating whether this element has at least one attribute.
xmlelement-haselements-method|Gets a value indicating whether this element has at least one child element.
xmlelement-innertext-method|Gets the concatenated values of the node and all its child nodes.
xmlelement-innerxml-method|Gets the markup representing only the child nodes of this node.
xmlelement-isempty-method|Gets a value indicating whether this element contains no content.
xmlelement-localname-method|Gets the local name of this element.
xmlelement-name-method|Gets the fully qualified name of this element.
xmlelement-namespaceuri-method|Gets the namespace URI of this element.
xmlelement-remove-method|Removes this node from its parent element.
xmlelement-removeallattributes-method|Removes the attributes of this element.
RemoveAttribute(Text)<xmlelement-removeattribute-string-method>|Removes the specified attribute from this element.
RemoveAttribute(Text, Text)<xmlelement-removeattribute-string-string-method>|Removes the specified attribute from this element.
xmlelement-removeattribute-xmlattribute-method|Removes the specified attribute from this element.
xmlelement-removenodes-method|Removes the child nodes from this element.
ReplaceNodes(Any,...)<xmlelement-replacenodes-method>|Replaces the children nodes of this element with the specified content.
ReplaceWith(Any,...)<xmlelement-replacewith-method>|Replaces this node with the specified content.
SelectNodes(Text, var XmlNodeList)<xmlelement-selectnodes-string-xmlnodelist-method>|Selects a list of nodes matching the XPath expression.
SelectNodes(Text, XmlNamespaceManager, var XmlNodeList)<xmlelement-selectnodes-string-xmlnamespacemanager-xmlnodelist-method>|Selects a list of nodes matching the XPath expression.
SelectSingleNode(Text, var XmlNode)<xmlelement-selectsinglenode-string-xmlnode-method>|Selects the first XmlNode that matches the XPath expression.
SelectSingleNode(Text, XmlNamespaceManager, var XmlNode)<xmlelement-selectsinglenode-string-xmlnamespacemanager-xmlnode-method>|Selects the first XmlNode that matches the XPath expression.
SetAttribute(Text, Text)<xmlelement-setattribute-string-string-method>|Sets the value of the specified attribute or create it if is not part of the element's attribute collection.
SetAttribute(Text, Text, Text)<xmlelement-setattribute-string-string-string-method>|Sets the value of the specified attribute or create it if is not part of the element's attribute collection.
xmlelement-writeto-outstream-method|Serializes and saves the current node to the given variable.
xmlelement-writeto-xmlwriteoptions-outstream-method|Serializes and saves the current node to the given variable.
WriteTo(var Text)<xmlelement-writeto-text-method>|Serializes and saves the current node to the given variable.
WriteTo(XmlWriteOptions, var Text)<xmlelement-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/xmlelement/xmlelement-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/xmlelement/xmlelement-data-type/
