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

# Format to cXML

> Converts your data into a cXML document, with the matching cXML document type declaration.

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

Turns your data into a cXML document. cXML is the XML format used to exchange purchasing messages such as orders, invoices, and catalogs between business systems. It works like the standard XML formatter but also adds the correct cXML document type declaration at the top of the document, so the receiving system knows exactly which kind of cXML message it is reading.

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

## Fields

<FormField property="rootNodeName" label="Root element name">
  The name of the outermost element wrapping the document. Leave it empty to use `cXML`, which is the standard for cXML messages.
</FormField>

<FormField property="dtd" label="Document Type Definition (DTD)">
  Which kind of cXML message you are sending. This sets the document type declaration at the top of the file so the receiver knows how to read it. Choose the option that matches your message, such as an invoice or a confirmation. Leave it empty to use the basic cXML document. See the [cXML documentation](https://xml.cxml.org/current/cXMLGettingStarted.pdf) for what each type covers.
</FormField>

<FormField property="version" label="DTD version">
  The cXML version the document declaration should reference. Leave it empty to use `1.2.014`.
</FormField>

<FormField property="noCdataWrapping" label="Disable cData wrapping">
  An on/off toggle, off by default. When off, any value that contains markup characters such as `<`, `>` or `&` is wrapped in a `<![CDATA[ ... ]]>` block so it passes through untouched. Turn it on to escape those characters instead, so `<b>` is written as `&lt;b&gt;` and `&` as `&amp;`. Leave it off unless the receiving system cannot handle CDATA blocks.
</FormField>

## Sample data

| Field | Value |
| - | - |
| Root element name | empty (uses `cXML`) |
| Document Type Definition (DTD) | Basic cXML document |
| DTD version | empty (uses `1.2.014`) |
| Disable cData wrapping | off |

Input:

```json theme={null}
{
    "Header": {
        "From": {
            "Credential": { "Identity": "AcmeSupplier" }
        }
    }
}
```

Output (a single text value; `\n` marks the line breaks):

```json theme={null}
"<?xml version=\"1.0\"?><!DOCTYPE cXML SYSTEM \"http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd\">\n<cXML><Header><From><Credential><Identity>AcmeSupplier</Identity></Credential></From></Header></cXML>\n"
```

Written out, the cXML document reads:

```xml theme={null}
<?xml version="1.0"?>
<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd">
<cXML>
  <Header>
    <From>
      <Credential>
        <Identity>AcmeSupplier</Identity>
      </Credential>
    </From>
  </Header>
</cXML>
```

A value that contains markup, such as a comment of `Deliver <b>before 10:00</b> & call on arrival`, is written as `<Comments><![CDATA[Deliver <b>before 10:00</b> & call on arrival]]></Comments>` with the default settings. With Disable cData wrapping on, the same value becomes `<Comments>Deliver &lt;b&gt;before 10:00&lt;/b&gt; &amp; call on arrival</Comments>`.

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


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