> For the complete documentation index, see [llms.txt](https://maya-admin.gitbook.io/building-skills/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://maya-admin.gitbook.io/building-skills/product/node-library/parser/xml.md).

# XML

Converts between an XML string and its JavaScript object representation, in either direction.

### Inputs

* `payload` (object | string) : A JavaScript object or XML string.
* `options` (object) : This optional property can be used to pass in any of the options supported by the underlying library used to convert to and from XML. See [the xml2js docs](https://github.com/Leonidas-from-XIV/node-xml2js/blob/master/README.md#options) for more information.

### Outputs

* `payload` (object | string) :
  * If the input is a string it tries to parse it as XML and creates a JavaScript object.
  * If the input is a JavaScript object it tries to build an XML string.

![](https://1551505950-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mkaq90Au3F8Kz0qIFzO%2Fuploads%2Fgit-blob-5504b7832ff09ad9f19af2f4ce61d5f5f993c031%2Fimage.png?alt=media)

### Details

When converting between XML and an object, any XML attributes are added as a property named `$` by default. Any text content is added as a property named `_`. These property names can be specified in the node configuration.

For example, the following XML will be converted as shown:

```
<p class="tag">Hello World</p>
```

```
{
  "p": {
    "$": {
      "class": "tag"
    },
    "_": "Hello World"
  }
}
```
