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

# Parse from XML

> Parses an XML string into a data object.

export const FormField = ({property, label, required = false, diType, uiPatterns, children}) => {
  const patterns = Array.isArray(uiPatterns) ? uiPatterns : uiPatterns ? [uiPatterns] : [];
  return <div style={{
    margin: '1.5rem 0'
  }}>
      <div style={{
    display: 'flex',
    alignItems: 'baseline',
    flexWrap: 'wrap',
    gap: '0.5rem',
    marginBottom: '0.25rem'
  }}>
        <strong>{label}</strong>
        <span style={{
    fontSize: '0.7rem',
    fontWeight: 600,
    textTransform: 'uppercase',
    letterSpacing: '0.04em',
    color: required ? '#6241f5' : '#6b7280'
  }}>
          {required ? 'Required' : 'Optional'}
        </span>
      </div>

      <div>{children}</div>

      {diType || patterns.length > 0 ? <p style={{
    fontSize: '0.85rem',
    color: '#6b7280',
    marginBottom: 0
  }}>
          {diType ? <>
              See the <a href={`/references/${diType}`}>{diType}</a> reference.{' '}
            </> : null}
          {patterns.length > 0 ? <>
              Accepts a <a href={`/documentation/placeholders-and-patterns/patterns#${patterns[0]}`}>pattern</a>.
            </> : null}
        </p> : null}
    </div>;
};

Parses an XML string into a data object. Use this when a value arrives as XML wrapped up in a single piece of text, for example a JSON response from a service that holds an XML document in one of its fields, or a message whose body is XML. It reads the text and turns the tags and their contents into structured data, so values that were buried inside XML elements become regular fields you can read and map.

Element attributes appear as fields prefixed with `@`, so `<product sku="A1">` becomes a field named `@sku`.

This documentation describes: [Schema](/schemas/mapper/deserialize-xml)

## Fields

<FormField property="xmlTypeCastAttributes" label="Automatically type cast values">
  Controls whether values that look like numbers are turned into real numbers. When on (the default), an attribute such as `qty="007"` comes back as the number `7`. Turn it off to keep every value exactly as written in the XML, mapping items one-to-one without changing their type.
</FormField>

## Sample data

| Field                          | Value        |
| ------------------------------ | ------------ |
| Automatically type cast values | On (default) |

Input:

```json theme={null}
{
    "payload": "<product sku=\"A1\" qty=\"007\"><name>Wool scarf</name></product>"
}
```

Output:

```json theme={null}
{
    "payload": {
        "@sku": "A1",
        "@qty": 7,
        "name": "Wool scarf"
    }
}
```

```json Configuration theme={null}
{
  "prototype": "deserialize-xml",
  "parameters": {
    "xmlTypeCastAttributes": true
  }
}
```
