# XML

Read XML into data, or build XML from data.

## Do things in XML

Add an **XML** step and choose an **Operation**. Choose the row to see the fields of each.

- [Convert XML](https://docs.gorunner.io/apps/xml#fields-f-convert): Parse (XML → data) · Build (data → XML)

Later steps read a step’s output by its name: see [Use data from earlier steps](https://docs.gorunner.io/build/use-data-from-earlier-steps).

Not in your list? See [When an app isn’t here](https://docs.gorunner.io/apps/when-an-app-isnt-here#q-not-in-list).

## For developers

In the API, which calls apps pieces, XML is `pieceId: "xml"` with `actionId: "convert"`, set by `operation`. [Get an app](https://docs.gorunner.io/api/apps/get-app) returns every field.

It computes from its inputs only (`pure`). See [How versions and side effects work](https://docs.gorunner.io/apps#q-versions).

### XML › Convert XML

Parse an XML string to data, or build an XML string from data.

### Parse (XML → data)

- **XML Text · Required**: Paste the XML you want to read, such as \<user>\<name>Ann\</name>\</user>.
- **Trim Whitespace · Optional**: Turn on to remove extra spaces and line breaks around each value while reading the XML. On by default.
- **Always return an array · Optional**: Keep every repeated element as an array even when the document contains only one of it (stable shape for downstream steps). Off by default.

### Build (data → XML)

- **Data · Required**: Object to serialize to XML.
- **Root Element · Optional**: Name for the single outermost tag that wraps the XML, such as user or order. Default: root.
- **Omit XML Declaration · Optional**: Turn on to leave out the top \<?xml version="1.0"?> line from the built XML. Off by default.

Source: https://docs.gorunner.io/apps/xml
