XML Functions

Build and parse XML documents.

Example: Build XML from Object

Build XML Document

Construct object and convert to XML

Object

Construct

key 1
name
value 1
Alice
key 2
email
output

XML

Build

object
output
rootName
user
pretty
True
xml

Build

Convert a JSON object to an XML string.

InputTypeDefaultDescription
objectjson—Data to convert
rootNamestringrootRoot element name
doctypestring—DOCTYPE declaration
prettybooleantruePretty-print with indentation
indentstring2 spacesIndentation string
newlinestring—Newline character
versionstring1.0XML version
encodingstringUTF-8XML encoding
standalonebooleantrueStandalone declaration

Output: xml (string)

Parse

Convert an XML string to a JSON object.

InputTypeDefaultDescription
xmlstring—XML to parse
attrkeystring$Key for attributes
charkeystring_Key for text content
explicitCharkeybooleanfalseAlways use charkey
trimbooleanfalseTrim whitespace
normalizeTagsbooleanfalseLowercase tag names
normalizebooleanfalseNormalize whitespace
explicitRootbooleanfalseInclude root element

Output: output (json)