Skip to content

XML Schema Validator

The XML Schema validator checks an XML file against an XSD (XML Schema Definition) you provide. It's the XML counterpart to the JSON Schema validator and follows the same pattern: structure goes in the schema, behaviour goes in CEL step assertions.

It's the right tool when the XML format you accept has a published or in-house XSD — e.g. SOAP envelopes, gbXML for building geometry, specific GovTech data exchange formats, or your own internally-defined schemas.

What you'll need

  • A Validibot account with permission to author workflows.
  • A workflow whose allowed file types include XML.
  • One or more XSD files defining the schema.
  • (Optional) Any namespace imports the schema depends on, if not inlined.

Setting up an XML Schema step

  1. Open the workflow editor and click Add step.
  2. Pick XML Schema from the validator library.
  3. Give the step a name and a short description.
  4. Upload your XSD file (and any imports it references).
  5. Click Save step.
  6. Add CEL step assertions for any cross-field rules the schema can't express on its own.

The XSD is parsed at save time, so namespace issues, missing references, or syntax errors are surfaced before any submission runs.

A note on XML data in CEL

When you write CEL assertions against XML, every element's text comes through as a string — XML has no native number type. To compare numerically, cast first:

double(p.price) > 0
int(p.count) >= 1

XML attributes are exposed with an @ prefix and bracket notation:

p.Materials.Material.all(m, double(m["@Conductivity"]) > 0.0)

That preserves the XML distinction between child elements (<Conductivity>160</Conductivity>) and attributes (Conductivity="160").

For the full XML-in-CEL rules, see the CEL Expressions page.

File types

XML Schema validator accepts XML. Make sure XML is enabled in the workflow's allowed file types.

Tips

  • Validate against a known-good document first. If your XSD imports other schemas, attach them all up front and check that a reference submission passes — it confirms the schema chain is wired correctly before any real submitter sees a confusing error.
  • Combine with CEL for cross-cutting rules. XSDs are great at shape, awkward at "if attribute mode is final then element signed_at must be present" — write that in CEL.
  • Keep the XSD in version control. Treat the schema as a versioned artifact; upload a new copy to Validibot when it changes and bump the workflow's version.

Where to next

Spotted a problem on this page? Report it or suggest an edit