Home Docs Schema Formats Errors
Conduit

XML

XML input and output

Conduit provides full XML support for both input and output. XML is parsed into schema‑aware rows, and responses are generated using a stable, predictable element structure.

XML Input

To send XML to Conduit, set the Content-Type header to application/xml or text/xml.

<book>
  <title>Example</title>
  <created_at>2024-01-01T00:00:00Z</created_at>
</book>

Conduit maps XML elements directly into schema‑aware rows. Nested structures are flattened according to XML parsing rules, and extra fields not present in the schema are preserved.

XML Output

XML output is selected when:

  • ?format=xml is used
  • Accept: application/xml is sent
  • The input format is XML
GET /v1/books?format=xml

Example response:

<?xml version="1.0" encoding="UTF-8"?>
<response>
  <item>
    <id>1</id>
    <title>Example</title>
    <created_at>2024-01-01T00:00:00Z</created_at>
  </item>
</response>

XML Schema Responses

Schema endpoints return XML describing the table’s columns, types, and metadata.

GET /v1/schema/books?format=xml

Example:

<?xml version="1.0" encoding="UTF-8"?>
<schema>
  <columns>
    <column>
      <name>id</name>
      <type>INTEGER</type>
      <pk>true</pk>
      <autoincrement>true</autoincrement>
    </column>
    <column>
      <name>title</name>
      <type>TEXT</type>
      <nullable>false</nullable>
    </column>
    <column>
      <name>created_at</name>
      <type>TEXT</type>
    </column>
  </columns>
</schema>

XML Error Responses

Conduit returns a consistent XML error envelope for all error conditions. This structure is identical across all formats (JSON, XML, YAML, TOML, NDJSON, CSV, CBOR).

Example XML error:

<?xml version="1.0" encoding="UTF-8"?>
<response>
  <error>
    <title>Resource Not Found</title>
    <message>The requested record does not exist.</message>
    <status>404</status>
    <documentation_url>https://docs.conduit.dev/errors/not-found</documentation_url>
    <details>
      <item>No record with ID 999 exists in table 'books'.</item>
    </details>
  </error>
</response>

The fields in the error envelope come directly from the ErrorSpec used by Conduit’s internal error system.

Format Negotiation

XML is selected when:

  • ?format=xml is used
  • Accept: application/xml is sent
  • The input format is XML
GET /v1/books?format=xml