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

> Reads cXML documents and turns them into structured data you can map and transform.

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>;
};

Reads cXML documents (the XML format used for purchase orders, invoices, and other procurement messages) and turns them into structured data you can map and transform. cXML files normally begin with a `<!DOCTYPE ...>` declaration that points at an external definition; this parser removes that declaration before reading the document, so the data loads even when that external definition is not reachable. XML attributes become keys prefixed with `@`, and nested elements become nested objects.

This documentation describes: [Schema](/schemas/deserializer/cxml)

## Fields

<FormField property="encodeInput" label="Input data is not UTF-8 encoded">
  An on/off toggle, off by default, which assumes the incoming cXML is already UTF-8. Turn it on only when the file 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="Convert from" required>
  Shown only when "Input data is not UTF-8 encoded" is on, and required there. The character set the file 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

Input (a cXML purchase order):

```xml theme={null}
<cXML payloadID="123" timestamp="2024-01-01T10:00:00">
  <Header>
    <From>
      <Credential domain="NetworkID"><Identity>SupplierA</Identity></Credential>
    </From>
  </Header>
  <Request>
    <OrderRequest>
      <OrderRequestHeader orderID="PO-1024" type="new"/>
    </OrderRequest>
  </Request>
</cXML>
```

Output:

```json theme={null}
{
    "@payloadID": 123,
    "@timestamp": "2024-01-01T10:00:00",
    "Header": {
        "From": {
            "Credential": {
                "@domain": "NetworkID",
                "Identity": "SupplierA"
            }
        }
    },
    "Request": {
        "OrderRequest": {
            "OrderRequestHeader": {
                "@orderID": "PO-1024",
                "@type": "new",
                "#": ""
            }
        }
    }
}
```

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