> ## 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 cXML

> Parses a cXML 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 a cXML string into a data object. cXML is the XML-based format used for procurement documents such as purchase orders, order confirmations, ship notices, and invoices. Use this when a cXML message arrives as a single piece of text and you want to turn it into structured data, so values that were buried in XML tags and attributes become regular fields you can read and map.

Element attributes appear as fields prefixed with `@`, and the text inside an element appears under a `#` field. The document type line at the top of the message (the `<!DOCTYPE ...>` declaration) and comments are removed automatically, so you do not need to strip them yourself.

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

## Fields

<FormField property="xmlTypeCastAttributes" label="Automatically type cast values">
  Controls whether attribute values that look like numbers are turned into real numbers. When on (the default), an attribute such as `payloadID="123"` comes back as the number `123`. Turn it off to keep every attribute exactly as written in the cXML, mapping values one-to-one without changing their type. Attribute values with a leading zero are never converted, and the text inside elements is always kept as written.
</FormField>

<FormField property="encodeInput" label="Input data is not UTF-8 encoded">
  An on/off toggle, off by default, which assumes the incoming text is already UTF-8. Turn it on only when the message uses a different character set so that accented and other special characters come through correctly. When on, two extra options appear so you can describe the original character set.
</FormField>

<FormField property="encodingFrom" label="Input encoding" required>
  Shown only when "Input data is not UTF-8 encoded" is on, and required there. The character set the message is actually saved in, so it can be converted to UTF-8 before parsing. Choose from UTF-16, ISO-8859-1, or Windows-1252.
</FormField>

<FormField property="modifier" label="On unconvertible characters">
  Shown only when conversion is on. Controls what happens to a character that has no UTF-8 equivalent: NONE stops with an error, IGNORE drops the character, and TRANSLIT replaces it with the closest similar character.
</FormField>

## Sample data

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

Input:

```json theme={null}
{
    "payload": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><cXML payloadID=\"123\" timestamp=\"2026-06-19T10:00:00+00:00\"><Request><OrderRequest><OrderRequestHeader orderID=\"PO-1001\" type=\"new\"/></OrderRequest></Request></cXML>"
}
```

Output:

```json theme={null}
{
    "payload": {
        "@payloadID": 123,
        "@timestamp": "2026-06-19T10:00:00+00:00",
        "Request": {
            "OrderRequest": {
                "OrderRequestHeader": {
                    "@orderID": "PO-1001",
                    "@type": "new",
                    "#": ""
                }
            }
        }
    }
}
```

Because type casting is on, `payloadID="123"` comes back as the number `123`. With the option off it stays the text `"123"`, and the rest of the output is unchanged.

```json Configuration theme={null}
{
  "prototype": "deserialize-cxml",
  "parameters": {}
}
```


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