XML
Load XML documents in memory, select nodes, texts and attributes, insert, update and delete them, convert between XML and JSON, validate against an XSD and apply XSLT. Typical uses: read an XML feed from a partner, produce an XML message from data.
xml loadxml showxml docxml existxml countxml select nodexml select textxml select attributexml xpathxml fieldsxml itextxml inodexml utextxml iattributexml dattributexml dnodexml unloadxml unload_allxml escape_10xml escape_11xml to_jsonxml to_jsonjson to_xmljson to_xmlxml validatexml xsltxml xslt

xml load <key> <xmlString> <encoding>


Description

    To load an XML string

Parameters

    key:   The key - string - required
    xmlString:   The XML string - string - required
    encoding:   The encoding - string - not required
admin
xml load "keyId" "<data id=\"25\"><item>A</item><item>B</item><item>C</item></data>";
mentdb
1
Used in use cases (10 recipes)

    XML, HTML & Word integrator › Purchase order in XML to a JSON for the API
    API & database integrator › B2B checkout: VAT check, payment link, mail and ERP order
    XML, HTML & Word integrator › Reshape an XML shipment notice for a partner
    XML, HTML & Word integrator › Fill a Word template, then check the result as XML
    XML, HTML & Word integrator › Build a SEPA credit transfer XML (pain.001)
    XML, HTML & Word integrator › Control a UBL e-invoice before booking it
    and 4 more in the Use cases
Often used with

    xml select text  ·  xml count  ·  xml unload  ·  json doc  ·  string regexp_replace  ·  xml select attribute  ·  xml fields  ·  json iobject

xml show


Description

    To show all XML objects saved in the session

admin
xml show;
mentdb
[<br> "keyId"<br>]
Used in use cases (1 recipe)

    XML, HTML & Word integrator › Reshape an XML shipment notice for a partner
Often used with

    json doc  ·  string regexp_replace  ·  string upper  ·  xml count  ·  xml dattribute  ·  xml dnode  ·  xml doc  ·  xml escape_10

xml doc <key>


Description

    Return the XML document

Parameters

    key:   The key - string - required
admin
xml doc "keyId";
mentdb
<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?> <data id=\"25\"> <item>A</item> <item>B</item> <item>C</item> </data>
Used in use cases (3 recipes)

    XML, HTML & Word integrator › Reshape an XML shipment notice for a partner
    XML, HTML & Word integrator › Build a SEPA credit transfer XML (pain.001)
    XML, HTML & Word integrator › Promote an XML logging configuration from dev to prod
Often used with

    string regexp_replace  ·  xml iattribute  ·  xml inode  ·  xml load  ·  xml count  ·  xml dattribute  ·  xml dnode  ·  xml escape_11

xml exist <key>


Description

    To check if a key is loaded

Parameters

    key:   The key - string - required
admin
xml exist "keyId"
mentdb
1
Used in use cases (2 recipes)

    XML, HTML & Word integrator › Reshape an XML shipment notice for a partner
    XML, HTML & Word integrator › Build a SEPA credit transfer XML (pain.001)
Often used with

    string regexp_replace  ·  xml count  ·  xml doc  ·  xml escape_11  ·  xml iattribute  ·  xml inode  ·  xml itext  ·  xml load

xml count <key> <xPath>


Description

    To count the objects in an XML document

Parameters

    key:   The key - string - required
    xPath:   The XPath string - string - required
admin
xml count "keyId" "/data"
mentdb
1
Used in use cases (8 recipes)

    XML, HTML & Word integrator › Purchase order in XML to a JSON for the API
    XML, HTML & Word integrator › Reshape an XML shipment notice for a partner
    XML, HTML & Word integrator › Fill a Word template, then check the result as XML
    XML, HTML & Word integrator › Build a SEPA credit transfer XML (pain.001)
    XML, HTML & Word integrator › Control a UBL e-invoice before booking it
    XML, HTML & Word integrator › Stage XML orders in an HSQL database and export them as XML
    and 2 more in the Use cases
Often used with

    xml load  ·  xml select text  ·  xml unload  ·  json doc  ·  string regexp_replace  ·  xml select attribute  ·  json iobject  ·  xml escape_11

xml select node <key> <xPath>


Description

    To select a node in an XML document

Parameters

    key:   The key - string - required
    xPath:   The XPath string - string - required
admin
xml select node "keyId" "/data";
mentdb
<?xml version="1.0" encoding="UTF-8"?><data id="25"> <item>A</item> <item>B</item> <item>C</item> </data>
Used in use cases (2 recipes)

    XML, HTML & Word integrator › Reshape an XML shipment notice for a partner
    XML, HTML & Word integrator › Build a SEPA credit transfer XML (pain.001)
Often used with

    string regexp_replace  ·  xml count  ·  xml doc  ·  xml escape_11  ·  xml exist  ·  xml iattribute  ·  xml inode  ·  xml itext

xml select text <key> <xPath>


Description

    To select a text in an XML document

Parameters

    key:   The key - string - required
    xPath:   The XPath string - string - required
admin
xml select text "keyId" "/data/item[1]"
mentdb
A
Used in use cases (9 recipes)

    XML, HTML & Word integrator › Purchase order in XML to a JSON for the API
    API & database integrator › B2B checkout: VAT check, payment link, mail and ERP order
    XML, HTML & Word integrator › Reshape an XML shipment notice for a partner
    XML, HTML & Word integrator › Fill a Word template, then check the result as XML
    XML, HTML & Word integrator › Build a SEPA credit transfer XML (pain.001)
    XML, HTML & Word integrator › Control a UBL e-invoice before booking it
    and 3 more in the Use cases
Often used with

    xml load  ·  xml count  ·  xml unload  ·  json doc  ·  string regexp_replace  ·  xml select attribute  ·  json iobject  ·  xml escape_11

xml select attribute <key> <xPath>


Description

    To select an attribute in an XML document

Parameters

    key:   The key - string - required
    xPath:   The XPath string - string - required
admin
xml select attribute "keyId" "/data/@id"
mentdb
25
Used in use cases (5 recipes)

    XML, HTML & Word integrator › Purchase order in XML to a JSON for the API
    XML, HTML & Word integrator › Control a UBL e-invoice before booking it
    XML, HTML & Word integrator › Stage XML orders in an HSQL database and export them as XML
    XML, HTML & Word integrator › Promote an XML logging configuration from dev to prod
    XML, HTML & Word integrator › GPS track (GPX): distance, climb and average speed
Often used with

    xml load  ·  xml unload  ·  xml count  ·  xml select text  ·  xml fields  ·  json doc  ·  json iobject  ·  string regexp_replace

xml xpath <key> <xPath>


Description

    To generate all the XPath strings of a node

Parameters

    key:   The key - string - required
    xPath:   The XPath string - string - required
admin
xml xpath "keyId" "/data";
mentdb
[<br> "/data",<br> "/data[@id\u003d\u002725\u0027]",<br> "/data/item",<br> "/data/item[2]",<br> "/data/item[3]"<br>]
Used in use cases (1 recipe)

    XML, HTML & Word integrator › Reshape an XML shipment notice for a partner
Often used with

    json doc  ·  string regexp_replace  ·  string upper  ·  xml count  ·  xml dattribute  ·  xml dnode  ·  xml doc  ·  xml escape_10

xml fields <key> <xPath>


Description

    To show all the field names of a node

Parameters

    key:   The key - string - required
    xPath:   The XPath string - string - required
admin
xml fields "keyId" "/data"
mentdb
[<br> "item",<br> "item",<br> "item"<br>]
Used in use cases (4 recipes)

    XML, HTML & Word integrator › Purchase order in XML to a JSON for the API
    XML, HTML & Word integrator › Build a SEPA credit transfer XML (pain.001)
    XML, HTML & Word integrator › Stage XML orders in an HSQL database and export them as XML
    XML, HTML & Word integrator › Promote an XML logging configuration from dev to prod
Often used with

    xml load  ·  xml unload  ·  string regexp_replace  ·  xml count  ·  xml select attribute  ·  xml select text  ·  xml doc  ·  xml iattribute

xml itext <key> <xPath> <nodeName> <text>


Description

    To insert a new text node

Parameters

    key:   The key - string - required
    xPath:   The XPath string - string - required
    nodeName:   The node name - string - required
    text:   The text - string - required
admin
xml itext "keyId" "/data" "number" "456";
mentdb
1
Used in use cases (2 recipes)

    XML, HTML & Word integrator › Reshape an XML shipment notice for a partner
    XML, HTML & Word integrator › Build a SEPA credit transfer XML (pain.001)
Often used with

    string regexp_replace  ·  xml count  ·  xml doc  ·  xml escape_11  ·  xml exist  ·  xml iattribute  ·  xml inode  ·  xml load

xml inode <key> <xPath> <node>


Description

    To insert a node into an XML document

Parameters

    key:   The key - string - required
    xPath:   The XPath string - string - required
    node:   The node - string - required
admin
xml inode "keyId" "/data" "<a><a1></a1><a2></a2></a>";
mentdb
1
Used in use cases (3 recipes)

    XML, HTML & Word integrator › Reshape an XML shipment notice for a partner
    XML, HTML & Word integrator › Build a SEPA credit transfer XML (pain.001)
    XML, HTML & Word integrator › Promote an XML logging configuration from dev to prod
Often used with

    string regexp_replace  ·  xml doc  ·  xml iattribute  ·  xml load  ·  xml count  ·  xml dattribute  ·  xml dnode  ·  xml escape_11

xml utext <key> <xPath> <text>


Description

    To update a text in an XML document

Parameters

    key:   The key - string - required
    xPath:   The XPath string - string - required
    text:   The text - string - required
admin
xml utext "keyId" "/data/item[2]" "Z";
mentdb
1
Used in use cases (2 recipes)

    XML, HTML & Word integrator › Reshape an XML shipment notice for a partner
    XML, HTML & Word integrator › Build a SEPA credit transfer XML (pain.001)
Often used with

    string regexp_replace  ·  xml count  ·  xml doc  ·  xml escape_11  ·  xml exist  ·  xml iattribute  ·  xml inode  ·  xml itext

xml iattribute <key> <xPath> <attributeName> <text>


Description

    To add a new attribute to a node

Parameters

    key:   The key - string - required
    xPath:   The XPath string - string - required
    attributeName:   The attribute name - string - required
    text:   The text - string - required
admin
xml iattribute "keyId" "/data" "id" "987";
mentdb
1
Used in use cases (3 recipes)

    XML, HTML & Word integrator › Reshape an XML shipment notice for a partner
    XML, HTML & Word integrator › Build a SEPA credit transfer XML (pain.001)
    XML, HTML & Word integrator › Promote an XML logging configuration from dev to prod
Often used with

    string regexp_replace  ·  xml doc  ·  xml inode  ·  xml load  ·  xml count  ·  xml dattribute  ·  xml dnode  ·  xml escape_11

xml dattribute <key> <xPath> <attributeName>


Description

    To delete an attribute from a node

Parameters

    key:   The key - string - required
    xPath:   The XPath string - string - required
    attributeName:   The attribute name - string - required
admin
xml dattribute "keyId" "/data" "id";
mentdb
1
Used in use cases (2 recipes)

    XML, HTML & Word integrator › Reshape an XML shipment notice for a partner
    XML, HTML & Word integrator › Promote an XML logging configuration from dev to prod
Often used with

    string regexp_replace  ·  xml dnode  ·  xml doc  ·  xml iattribute  ·  xml inode  ·  xml load  ·  date sysdate  ·  file count_lines

xml dnode <key> <xPath>


Description

    To delete a specific node

Parameters

    key:   The key - string - required
    xPath:   The XPath string - string - required
admin
xml dnode "keyId" "/data/item[2]";
mentdb
1
Used in use cases (2 recipes)

    XML, HTML & Word integrator › Reshape an XML shipment notice for a partner
    XML, HTML & Word integrator › Promote an XML logging configuration from dev to prod
Often used with

    string regexp_replace  ·  xml dattribute  ·  xml doc  ·  xml iattribute  ·  xml inode  ·  xml load  ·  date sysdate  ·  file count_lines

xml unload <key>


Description

    To unload an XML document

Parameters

    key:   The key - string - required
admin
xml unload "keyId";
mentdb
1
Used in use cases (7 recipes)

    XML, HTML & Word integrator › Purchase order in XML to a JSON for the API
    XML, HTML & Word integrator › Build a SEPA credit transfer XML (pain.001)
    XML, HTML & Word integrator › Control a UBL e-invoice before booking it
    XML, HTML & Word integrator › Stage XML orders in an HSQL database and export them as XML
    XML, HTML & Word integrator › RSS feed to an HTML news digest
    XML, HTML & Word integrator › Promote an XML logging configuration from dev to prod
    and 1 more in the Use cases
Often used with

    xml load  ·  xml count  ·  xml select text  ·  xml select attribute  ·  xml fields  ·  string regexp_replace  ·  json doc  ·  json iobject

xml unload_all


Description

    To unload all JSON documents

admin
xml unload_all;
mentdb
1
Used in use cases (1 recipe)

    XML, HTML & Word integrator › Reshape an XML shipment notice for a partner
Often used with

    json doc  ·  string regexp_replace  ·  string upper  ·  xml count  ·  xml dattribute  ·  xml dnode  ·  xml doc  ·  xml escape_10

xml escape_10 <data>


Description

    Escape an XML value

Parameters

    data:   The data - string - required
admin
xml escape_10 "..."
mentdb
...
Used in use cases (1 recipe)

    XML, HTML & Word integrator › Reshape an XML shipment notice for a partner
Often used with

    json doc  ·  string regexp_replace  ·  string upper  ·  xml count  ·  xml dattribute  ·  xml dnode  ·  xml doc  ·  xml escape_11

xml escape_11 <data>


Description

    Escape an XML value

Parameters

    data:   The data - string - required
admin
xml escape_11 "..."
mentdb
...
Used in use cases (3 recipes)

    XML, HTML & Word integrator › Reshape an XML shipment notice for a partner
    XML, HTML & Word integrator › Build a SEPA credit transfer XML (pain.001)
    XML, HTML & Word integrator › RSS feed to an HTML news digest
Often used with

    xml count  ·  xml load  ·  xml select text  ·  string length  ·  string regexp_replace  ·  xml doc  ·  xml exist  ·  xml iattribute

xml to_json <xml>


Description

    Convert an XML document to JSON: attributes become "@name", repeated elements become arrays, an element with only text becomes its text, mixed content goes in "#text"; the namespace prefixes are removed

Parameters

    xml:   The XML (content starting with <, or a file path) - String - required
admin
xml to_json "<?xml version=\"1.0\"?><inv:Invoice xmlns:inv=\"urn:example:invoice\" number=\"F-2026-104\"><inv:Line n=\"1\"><Item>Cable</Item><Qty>2</Qty><Price>10.50</Price></inv:Line><inv:Line n=\"2\"><Item>Switch</Item><Qty>1</Qty><Price>49</Price></inv:Line><Paid>false</Paid></inv:Invoice>"
mentdb
{"Invoice": {"@number": "F-2026-104", "Line": [{"@n": "1", "Item": "Cable", "Qty": "2", "Price": "10.50"}, {"@n": "2", "Item": "Switch", "Qty": "1", "Price": "49"}], "Paid": "false"}}

xml to_json <xml> <json_params>


Description

    Convert an XML document to JSON with parameters: types ("string" or "auto": numbers and booleans), force_array (names of the elements always given as arrays, even when there is only one), strip_namespaces (true), attributes (true), root (true: keep the name of the root element)

Parameters

    xml:   The XML - String - required
    json_params:   The parameters - String - required
admin
xml to_json "<?xml version=\"1.0\"?><inv:Invoice xmlns:inv=\"urn:example:invoice\" number=\"F-2026-104\"><inv:Line n=\"1\"><Item>Cable</Item><Qty>2</Qty><Price>10.50</Price></inv:Line><inv:Line n=\"2\"><Item>Switch</Item><Qty>1</Qty><Price>49</Price></inv:Line><Paid>false</Paid></inv:Invoice>" "{\"types\": \"auto\"}"
mentdb
{"Invoice": {"@number": "F-2026-104", "Line": [{"@n": 1, "Item": "Cable", "Qty": 2, "Price": 10.5}, {"@n": 2, "Item": "Switch", "Qty": 1, "Price": 49}], "Paid": false}}
One order, but always an array of orders
admin
xml to_json "<orders><order id=\"A1\"><qty>3</qty></order></orders>" "{\"force_array\": [\"order\"], \"root\": false, \"types\": \"auto\"}"
mentdb
{"order": [{"@id": "A1", "qty": 3}]}
Used in use cases (1 recipe)

    XML, HTML & Word integrator › Receive an XML order file: validate it against its XSD, convert it to JSON rows and to YAML
Often used with

    json to_rows  ·  json to_yaml  ·  xml validate

json to_xml <json>


Description

    Convert JSON to an XML document: "@name" keys become attributes, "#text" the text, arrays repeated elements; an object with one key gives the root element

Parameters

    json:   The JSON - String - required
admin
json to_xml "{\"invoice\": {\"@number\": \"F-2026-104\", \"line\": [{\"item\": \"Cable\", \"qty\": 2}, {\"item\": \"Switch\", \"qty\": 1}], \"note\": {\"@lang\": \"fr\", \"#text\": \"Merci\"}}}"
mentdb
<?xml version="1.0" encoding="UTF-8"?> <invoice number="F-2026-104"> <line> <item>Cable</item> <qty>2</qty> </line> <line> <item>Switch</item> <qty>1</qty> </line> <note lang="fr">Merci</note> </invoice>

json to_xml <json> <json_params>


Description

    Convert JSON to XML with parameters: root (the name of the root element, "root" by default when the JSON has several keys), declaration (true), indent (2, 0 = on one line)

Parameters

    json:   The JSON - String - required
    json_params:   The parameters - String - required
admin
json to_xml "{\"id\": \"A1\", \"qty\": 3, \"tags\": [\"new\", \"urgent\"]}" "{\"root\": \"order\", \"indent\": 0, \"declaration\": false}"
mentdb
<order><id>A1</id><qty>3</qty><tags>new</tags><tags>urgent</tags></order>

xml validate <xml> <xsd>


Description

    Validate an XML document against an XSD schema: valid, the number of errors and the errors with their line and column (200 at most). An XML that cannot be parsed is reported as invalid

Parameters

    xml:   The XML (content or file path) - String - required
    xsd:   The XSD (content or file path; a file may include or import other local schemas) - String - required
admin
xml validate "<order id=\"A1\"><qty>3</qty><ref>R-12</ref></order>" "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"><xs:element name=\"order\"><xs:complexType><xs:sequence><xs:element name=\"qty\" type=\"xs:positiveInteger\"/><xs:element name=\"ref\" type=\"xs:string\"/></xs:sequence><xs:attribute name=\"id\" type=\"xs:string\" use=\"required\"/></xs:complexType></xs:element></xs:schema>"
mentdb
{"valid": true, "error_count": 0, "errors": []}
Invalid: negative quantity, missing attribute, unknown element
admin
xml validate "<order> <qty>-3</qty> <reference>R-12</reference> </order>" "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"><xs:element name=\"order\"><xs:complexType><xs:sequence><xs:element name=\"qty\" type=\"xs:positiveInteger\"/><xs:element name=\"ref\" type=\"xs:string\"/></xs:sequence><xs:attribute name=\"id\" type=\"xs:string\" use=\"required\"/></xs:complexType></xs:element></xs:schema>"
mentdb
{"valid": false, "error_count": 4, "errors": [{"line": 1, "column": 8, "message": "cvc-complex-type.4 : L'attribut 'id' doit figurer dans l'élément 'order'."}, {"line": 2, "column": 14, "message": "cvc-minInclusive-valid : La valeur '-3' n'est pas un facet valide par rapport à minInclusive '1' pour le type 'positiveInteger'."}, {"line": 2, "column": 14, "message": "cvc-type.3.1.3 : La valeur '-3' de l'élément 'qty' n'est pas valide."}, {"line": 3, "column": 12, "message": "cvc-complex-type.2.4.a : Contenu non valide trouvé à partir de l'élément 'reference'. L'une des valeurs '{ref}' est attendue."}]}
Used in use cases (1 recipe)

    XML, HTML & Word integrator › Receive an XML order file: validate it against its XSD, convert it to JSON rows and to YAML
Often used with

    json to_rows  ·  json to_yaml  ·  xml to_json

xml xslt <xml> <xsl>


Description

    Transform an XML document with an XSLT 1.0 stylesheet (text, XML or HTML output); the Java extension functions are disabled

Parameters

    xml:   The XML (content or file path) - String - required
    xsl:   The stylesheet (content or file path) - String - required
admin
xml xslt "<orders><order id=\"A1\"><qty>3</qty></order><order id=\"B7\"><qty>12</qty></order></orders>" "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"><xsl:output method=\"text\"/><xsl:param name=\"sep\" select=\"','\"/><xsl:template match=\"/\"><xsl:for-each select=\"orders/order\"><xsl:value-of select=\"@id\"/><xsl:value-of select=\"$sep\"/><xsl:value-of select=\"qty\"/><xsl:text> </xsl:text></xsl:for-each></xsl:template></xsl:stylesheet>"
mentdb
A1,3 B7,12

xml xslt <xml> <xsl> <json_params>


Description

    Transform with parameters: parameters (the values of the xsl:param of the stylesheet)

Parameters

    xml:   The XML - String - required
    xsl:   The stylesheet - String - required
    json_params:   The parameters - String - required
admin
xml xslt "<orders><order id=\"A1\"><qty>3</qty></order><order id=\"B7\"><qty>12</qty></order></orders>" "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"><xsl:output method=\"text\"/><xsl:param name=\"sep\" select=\"','\"/><xsl:template match=\"/\"><xsl:for-each select=\"orders/order\"><xsl:value-of select=\"@id\"/><xsl:value-of select=\"$sep\"/><xsl:value-of select=\"qty\"/><xsl:text> </xsl:text></xsl:for-each></xsl:template></xsl:stylesheet>" "{\"parameters\": {\"sep\": \";\"}}"
mentdb
A1;3 B7;12