> ## Documentation Index
> Fetch the complete documentation index at: https://docs.condotta.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# XML Tools

> Parse, convert, validate, and format XML data.

The XML Tools connector provides operations for working with XML: parsing, converting to and from JSON, formatting, and validation.

> [!NOTE]
>
> No connection required; this utility connector works out of the box.

## Tools

> [accordion] to-json: Convert XML to JSON
>
> **xml** `string` *required*
>
> XML string to convert.
>
> **ignoreAttributes** `boolean` (default: false)
>
> Ignore XML attributes.
>
> **attributePrefix** `string` (default: @\_)
>
> Prefix for attribute keys in JSON.
>
> **textNodeName** `string` (default: #text)
>
> Key name for text nodes.
>
> **preserveOrder** `boolean` (default: false)
>
> Preserve element order in output.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "xml": "<catalog><book id=\"1\"><title>Dune</title><price>12.99</price></book><book id=\"2\"><title>Neuromancer</title><price>9.99</price></book></catalog>"
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "value": {
>     "catalog": {
>       "book": [
>         { "@_id": "1", "title": "Dune", "price": 12.99 },
>         { "@_id": "2", "title": "Neuromancer", "price": 9.99 }
>       ]
>     }
>   }
> }
> ```

> [accordion] from-json: Convert JSON to XML
>
> **data** `any` *required*
>
> JSON data to convert.
>
> **rootName** `string` (default: root)
>
> Root element name.
>
> **attributePrefix** `string` (default: @\_)
>
> Prefix that identifies attributes.
>
> **textNodeName** `string` (default: #text)
>
> Key name for text content.
>
> **declaration** `boolean` (default: true)
>
> Include XML declaration.
>
> **pretty** `boolean` (default: true)
>
> Format with indentation.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "data": {
>     "user": {
>       "@_role": "admin",
>       "name": "Alice",
>       "email": "alice@example.com"
>     }
>   },
>   "declaration": true,
>   "pretty": true
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "result": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user role=\"admin\">\n  <name>Alice</name>\n  <email>alice@example.com</email>\n</user>"
> }
> ```

> [accordion] parse: Parse XML with metadata
>
> Parse XML and return structured data with metadata.
>
> **xml** `string` *required*
>
> XML string to parse.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "xml": "<order id=\"789\"><item sku=\"A1\">Widget</item><total>29.99</total></order>"
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "rootElement": "order",
>   "data": {
>     "order": {
>       "@_id": "789",
>       "item": {
>         "@_sku": "A1",
>         "#text": "Widget"
>       },
>       "total": 29.99
>     }
>   }
> }
> ```

> [accordion] prettify: Format XML
>
> Format XML with indentation for readability.
>
> **xml** `string` *required*
>
> XML string to format.
>
> **indent** `number` (default: 2)
>
> Number of indentation spaces.
>
> **encoding** `enum` (default: utf8)
>
> Output encoding for the `result` field: `utf8` (default) or `base64` (for email attachments, SFTP uploads, or knowledge-base embedding). The response includes an `encoding` tag.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "xml": "<root><name>Alice</name><age>30</age></root>",
>   "indent": 4
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "result": "<root>\n    <name>Alice</name>\n    <age>30</age>\n</root>"
> }
> ```

> [accordion] minify: Minify XML
>
> Remove all unnecessary whitespace from XML.
>
> **xml** `string` *required*
>
> XML string to minify.
>
> **encoding** `enum` (default: utf8)
>
> Output encoding for the `result` field: `utf8` (default) or `base64` (for email attachments, SFTP uploads, or knowledge-base embedding). The response includes an `encoding` tag.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "xml": "<root>\n  <name>Alice</name>\n  <age>30</age>\n</root>"
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "result": "<root><name>Alice</name><age>30</age></root>"
> }
> ```

> [accordion] validate: Validate XML
>
> Check if a string is valid XML.
>
> **xml** `string` *required*
>
> XML string to validate.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "xml": "<root><name>Alice</name></root>"
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "valid": true
> }
> ```

> [accordion] extract: Extract element by path
>
> Extract a specific element using dot-notation path.
>
> **xml** `string` *required*
>
> XML string.
>
> **path** `string` *required*
>
> Dot-notation path (e.g., `root.items.item`).
>
> **Example request:**
>
> ```json theme={null}
> {
>   "xml": "<catalog><books><book>Dune</book><book>Neuromancer</book></books></catalog>",
>   "path": "catalog.books.book"
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "value": ["Dune", "Neuromancer"]
> }
> ```

> [card] [Try this free for 14 days](https://preview.condotta.ai/signup)
>
> Start a 14-day trial on Band 1. At day 14, choose your band, or stop.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.