XML Functions
Build and parse XML documents.
Example: Build XML from Object
Build XML Document
Construct object and convert to XML
XML
Build
object
output
rootName
user
pretty
True
xml
Build
Convert a JSON object to an XML string.
| Input | Type | Default | Description |
|---|---|---|---|
| object | json | — | Data to convert |
| rootName | string | root | Root element name |
| doctype | string | — | DOCTYPE declaration |
| pretty | boolean | true | Pretty-print with indentation |
| indent | string | 2 spaces | Indentation string |
| newline | string | — | Newline character |
| version | string | 1.0 | XML version |
| encoding | string | UTF-8 | XML encoding |
| standalone | boolean | true | Standalone declaration |
Output: xml (string)
Parse
Convert an XML string to a JSON object.
| Input | Type | Default | Description |
|---|---|---|---|
| xml | string | — | XML to parse |
| attrkey | string | $ | Key for attributes |
| charkey | string | _ | Key for text content |
| explicitCharkey | boolean | false | Always use charkey |
| trim | boolean | false | Trim whitespace |
| normalizeTags | boolean | false | Lowercase tag names |
| normalize | boolean | false | Normalize whitespace |
| explicitRoot | boolean | false | Include root element |
Output: output (json)