Skip to main content

Squillify development is paused indefinitely. Read why, and discover what this experiment achieved. Read the story

MicroSkills Reference

Validate XML against XSD

schema.validate_xml_xsd

ProductionBounded custom (Class B)Deterministicstrictmoderatev1.0.0
File inputNo network

Overview

You send one XML document and the XSD schemas it should satisfy, and we validate it in a locked-down parser: no DTDs, no external entities, no fetching a schema from the network or the filesystem. An include or import inside your schemas resolves only to another schema you supplied, matched by the logical id you gave it, and anything else is refused rather than fetched. Problems come back with the line and column where they were found, so you can point straight at the offending element.

An ordinary XML validator will happily follow a reference in a hostile document and read a local file or call an internal service on the attacker's behalf. You get the same conformance answer from a parser that cannot leave the document you sent.

Reliability

Deterministic: the same document and schema set always produce the same findings. Failures are named so you can tell a data problem from a setup problem. XML_NOT_WELL_FORMED means the document does not parse at all, and it is recoverable by inspecting the real format before you retry. These are not: XSD_NOT_WELL_FORMED and XSD_COMPILE_FAILED for a schema we cannot read or compile, SCHEMA_ID_DUPLICATE when two entries share an id, SCHEMA_REFERENCE_NOT_SUPPLIED when a reference names something you did not send or when rootSchemaId is not among your schemas, EXTERNAL_ENTITY_FORBIDDEN when the document carries a DTD or entity, EXTERNAL_SCHEMA_FORBIDDEN when a schema reaches for a URL or a file path, and XML_DEPTH_LIMIT_EXCEEDED beyond 256 levels of nesting. We reject the call outright when xmlSource or schemas is missing or misshapen, when a schema entry has no id, when there are more than 16 schemas, or when they exceed 5242880 bytes together.

Context footprint

The document and the schema set are each capped at 5242880 bytes; the response holds at most maxErrors short findings plus a few summary fields. A successful call costs 1 execution credit.

When to use it

When XML has to satisfy XSD schemas you can supply, and especially when the document came from outside your control.

When the contract is a DTD, when you want the document transformed, or when the schemas can only be fetched from somewhere else.

Powered by the JDK's JAXP XML Schema validator, hardened against XXE and SSRF.

Scope

Note
We check one XML document against the XSD schemas you supply, offline, and report each problem with its line and column.

Non-goals

  • We never validate against a DTD, only against XSD
  • We never transform the document; there is no XSLT here
  • We never fetch a schema from the network or the filesystem
  • We never repair the XML or work out a schema for you

Properties

IdempotentRetry safeStreaming supportedFile input supportedRequires external service

Capabilities

validation

Cost & billing

Flat rate per invocation

MetercallsBillable onsuccessCost per call1 credit

File handling

Accepts file_refProduces file_refMax input5 MBMax file size5 MB

File limits

Constraints this skill applies to your input and generated files. The “Limited by” column shows the static source of each cap; none of these can be raised by upgrading your plan.

LimitValueLimited by
Maximum size per input file5 MiBSkill and platform maximum

How we handle your data

Sensitive input, safe output
What this means

This skill may receive sensitive content, but it does not target sensitive data and returns only a structured non-sensitive result.

Squillify guarantees
  • Runs inside Squillify
  • This skill runs inside Squillify.
  • Payloads are not sent to an external service by this skill.
  • Squillify does not permanently store submitted payloads.
  • Telemetry records metadata only, not submitted content.
  • Submitted payloads are not used for training.
  • Submitted payloads are not reviewed by humans.
  • This skill does not target sensitive data.
  • The response does not contain submitted content.
Your responsibility

Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.

Read the Microskill Data Handling Policy

Input schema

FieldTypeRequiredDescription
xmlSourceobjectYesClosed XML source: type inline with content, or type file_ref with a tenant-owned ref, at most 5242880 bytes.
schemasarrayYesXSD documents to compile, 1 through 16 closed {id, source} objects with unique ids.
rootSchemaIdstringNoId of the schema to compile from; omit it to compile every supplied schema together.
optionsobjectNoClosed maxErrors and treatWarningsAsErrors settings; omit the object for 100 findings and warnings that do not fail the document.

Output schema

FieldTypeRequiredDescription
validbooleanYesTrue when no errors were found, and also no warnings if treatWarningsAsErrors was set.
errorsarrayYesSchema errors in validator order, 0 through 1000 closed objects; empty when the document conforms.
warningsarrayYesSchema warnings, 0 through 1000 closed objects; usually empty for XSD.
documentobjectYesClosed observed root with the local rootElement name and an optional namespace URI that may be JSON null.
schemasobjectYesClosed compilation receipt with the starting schema id or JSON null, how many schemas were supplied and the ids actually pulled in.
_metaobjectYesClosed bookkeeping with xmlBytes and schemaBytes actually read plus the fixed offline validatorProfile.

API contract

POST /v1/execute
curl
curl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"schema.validate_xml_xsd","input":{"xmlSource":{"type":"inline","content":"<a/>"},"schemas":[{"id":"root.xsd","source":{"type":"inline","content":"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"><xs:element name=\"a\"/></xs:schema>"}}]}}'
Integrations
TypeScript SDK
import { Squillify } from "@squillify/sdk";

const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });

const { output } = await sq.execute("schema.validate_xml_xsd", {"xmlSource":{"type":"inline","content":"<a/>"},"schemas":[{"id":"root.xsd","source":{"type":"inline","content":"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'><xs:element name='a'/></xs:schema>"}}]});

Errors

CodeHTTPRetryableDescription
VALIDATION_ERROR400NoThe request payload failed schema validation.
UNAUTHORIZED401NoMissing or invalid API key.
SKILL_NOT_ACCESSIBLE403NoThe API key is not granted access to this skill.
SKILL_NOT_AVAILABLE_FOR_PLAN403NoThis skill is not included in your current plan.
PLAN_ELIGIBILITY_UNAVAILABLE503YesPlan eligibility could not be decided. Retry after backoff.
SKILL_NOT_FOUND404NoThe requested skill or version does not exist.
TENANT_RATE_LIMITED429YesRequest rate limit exceeded. Retry after backoff.
QUOTA_EXCEEDED429YesPlan quota exhausted. Retryable once the quota period resets.
EXECUTION_TIMEOUT504YesExecution exceeded the allowed time budget.
XML_NOT_WELL_FORMED400NoThe request payload failed this skill's input validation.
XSD_NOT_WELL_FORMED400NoThe request payload failed this skill's input validation.
XSD_COMPILE_FAILED400NoThe request payload failed this skill's input validation.
SCHEMA_ID_DUPLICATE400NoThe request payload failed this skill's input validation.
SCHEMA_REFERENCE_NOT_SUPPLIED400NoThe request payload failed this skill's input validation.
XML_DEPTH_LIMIT_EXCEEDED429NoA size, quota, rate, or time limit was exceeded.
EXTERNAL_ENTITY_FORBIDDEN422NoThe input was rejected as unsafe.
EXTERNAL_SCHEMA_FORBIDDEN422NoThe input was rejected as unsafe.

Other limits

LimitValue
Recommended inline bytes32 KiB

Limitations

  • We never validate against a DTD, only against XSD
  • We never transform the document; there is no XSLT here
  • We never fetch a schema from the network or the filesystem
  • We never repair the XML or work out a schema for you
  • Documents whose contract is a DTD rather than an XSD
  • Transforming or rewriting XML rather than checking it

How to call

POST /v1/execute (requires authentication)

Request bodyjson
{
  "skillKey": "schema.validate_xml_xsd",
  "input": {
    "xmlSource": {
      "type": "inline",
      "content": "<a/>"
    },
    "schemas": [
      {
        "id": "root.xsd",
        "source": {
          "type": "inline",
          "content": "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'><xs:element name='a'/></xs:schema>"
        }
      }
    ]
  }
}

Examples

Minimal valid XML against inline XSD

Inputjson
{
  "xmlSource": {
    "type": "inline",
    "content": "<a/>"
  },
  "schemas": [
    {
      "id": "root.xsd",
      "source": {
        "type": "inline",
        "content": "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'><xs:element name='a'/></xs:schema>"
      }
    }
  ]
}
Expected outputjson
{
  "document": {
    "rootElement": "a",
    "namespace": null
  },
  "_meta": {
    "validatorProfile": "offline-xsd-1",
    "xmlBytes": 4,
    "schemaBytes": 89
  },
  "errors": [],
  "valid": true,
  "schemas": {
    "rootSchemaId": null,
    "supplied": 1,
    "resolvedIncludes": []
  },
  "warnings": []
}

Schema violation on an unexpected element

Inputjson
{
  "rootSchemaId": "root.xsd",
  "xmlSource": {
    "type": "inline",
    "content": "<note><wrong>x</wrong></note>"
  },
  "schemas": [
    {
      "id": "root.xsd",
      "source": {
        "type": "inline",
        "content": "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'><xs:element name='note'><xs:complexType><xs:sequence><xs:element name='to' type='xs:string'/></xs:sequence></xs:complexType></xs:element></xs:schema>"
      }
    }
  ]
}
Expected outputjson
{
  "document": {
    "rootElement": "note",
    "namespace": null
  },
  "_meta": {
    "validatorProfile": "offline-xsd-1",
    "xmlBytes": 29,
    "schemaBytes": 204
  },
  "errors": [
    {
      "code": "SCHEMA_VALIDATION_ERROR",
      "message": "cvc-complex-type.2.4.a: Invalid content was found starting with element 'wrong'. One of '{to}' is expected.",
      "path": null,
      "line": null,
      "column": null,
      "severity": "error",
      "details": {}
    }
  ],
  "valid": false,
  "schemas": {
    "rootSchemaId": "root.xsd",
    "supplied": 1,
    "resolvedIncludes": []
  },
  "warnings": []
}
  • Check an incoming invoice or EDI document against its published XSD
  • Hold a partner integration to its XML contract before you process the file
  • Confirm a document is both well-formed and schema-conformant in one pass

Avoid for

  • Documents whose contract is a DTD rather than an XSD
  • Transforming or rewriting XML rather than checking it

Composable with

Safety & privacy

  • Runs without calling any external service.
  • Your payloads are never stored permanently.
  • Telemetry captures metadata only — never your payload contents.
  • We never train models on your payloads.
  • No human reviews your payloads.

Tags

schemavalidationxml