Validate XML against XSD
schema.validate_xml_xsd
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
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
Capabilities
Cost & billing
Flat rate per invocation
File handling
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.
| Limit | Value | Limited by |
|---|---|---|
| Maximum size per input file | 5 MiB | Skill and platform maximum |
How we handle your data
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.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| xmlSource | object | Yes | Closed XML source: type inline with content, or type file_ref with a tenant-owned ref, at most 5242880 bytes. |
| schemas | array | Yes | XSD documents to compile, 1 through 16 closed {id, source} objects with unique ids. |
| rootSchemaId | string | No | Id of the schema to compile from; omit it to compile every supplied schema together. |
| options | object | No | Closed maxErrors and treatWarningsAsErrors settings; omit the object for 100 findings and warnings that do not fail the document. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| valid | boolean | Yes | True when no errors were found, and also no warnings if treatWarningsAsErrors was set. |
| errors | array | Yes | Schema errors in validator order, 0 through 1000 closed objects; empty when the document conforms. |
| warnings | array | Yes | Schema warnings, 0 through 1000 closed objects; usually empty for XSD. |
| document | object | Yes | Closed observed root with the local rootElement name and an optional namespace URI that may be JSON null. |
| schemas | object | Yes | Closed compilation receipt with the starting schema id or JSON null, how many schemas were supplied and the ids actually pulled in. |
| _meta | object | Yes | Closed bookkeeping with xmlBytes and schemaBytes actually read plus the fixed offline validatorProfile. |
API contract
POST /v1/executecurl -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>"}}]}}'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
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
| XML_NOT_WELL_FORMED | 400 | No | The request payload failed this skill's input validation. |
| XSD_NOT_WELL_FORMED | 400 | No | The request payload failed this skill's input validation. |
| XSD_COMPILE_FAILED | 400 | No | The request payload failed this skill's input validation. |
| SCHEMA_ID_DUPLICATE | 400 | No | The request payload failed this skill's input validation. |
| SCHEMA_REFERENCE_NOT_SUPPLIED | 400 | No | The request payload failed this skill's input validation. |
| XML_DEPTH_LIMIT_EXCEEDED | 429 | No | A size, quota, rate, or time limit was exceeded. |
| EXTERNAL_ENTITY_FORBIDDEN | 422 | No | The input was rejected as unsafe. |
| EXTERNAL_SCHEMA_FORBIDDEN | 422 | No | The input was rejected as unsafe. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 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)
{
"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
{
"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>"
}
}
]
}{
"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
{
"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>"
}
}
]
}{
"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": []
}Recommended use cases
- 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
Related skills
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.