DataToolsLab
XML Tools

XSD Validator

Validate an XML document against an XSD schema and list every violation with the path that caused it.

Loading tool…

What is XSD Validator?

An XML Schema validator. It checks a document against the parts of XSD that real-world schemas use, and states clearly which parts it does not implement, so a pass is a useful signal rather than a false assurance.

How it works

The schema is parsed into element and attribute declarations, content models and simple types, and each document node is validated against its declaration: sequence, choice and all groups with their occurrence bounds, attribute use, fixed and default values, and the built-in types with pattern, enumeration, length and numeric-range facets. Every violation is reported with severity, the position in the document and the path involved.

  1. Paste the document. Drop in XML, a schema, a feed or an XPath expression. Everything is parsed in the page: no upload, no server round trip, and the tools keep working with the network switched off.
  2. Set the options that match your document. Indent unit, whether to keep comments, which dialect, which output method. The defaults are the safe ones — nothing that changes meaning is enabled for you.
  3. Read the result, then copy or download it. Results appear as you type, copy straight to the clipboard, and download with a sensible filename (.xml, .xsd, .csv). Reset returns every field to its default.

Examples

A minified document from an API response

Paste one line of XML and the Formatter indents it, wraps long start tags one attribute per line and normalises empty elements — without touching text inside mixed content.

An XPath that works in Chrome and not in your servlet

The XPath Tester evaluates against a real tree and reports the axis or function it cannot support, instead of returning zero nodes and letting you guess why.

A document that will not parse

The Validator gives line and column for every mismatched tag, stray ampersand and duplicate attribute, with the reason in words: which open element was expected, which was found.

A schema that only half matches your data

The XSD Validator marks each violation with the path of the offending node, and the Schema Generator goes the other way — inferring a starting-point XSD from real documents.

Common mistakes

Assuming a pretty-printer cannot change meaning

Whitespace between elements is often insignificant, but inside mixed content it is not: `<p>Hello <b>world</b></p>` must stay on one line. Formatting here re-indents element-only content and leaves mixed content alone.

Treating a validation pass as proof of interoperability

The DTD and XSD validators implement honest subsets. A document reported valid here can still be rejected by a full validator that understands identity constraints, substitution groups or XSD 1.1 assertions — each page lists what it does not cover.

Reading the whole document because the parser did

A DOCTYPE is not inert. If your parser resolves external entities, pasting an untrusted document is enough to read a file or call an internal URL. The XXE Risk Checker shows what a document asks for; the fix is in the parser configuration.

Forgetting that attributes and elements are not interchangeable

`<id>1</id>` and `id="1"` mean different things to every schema and every XPath. When converting to CSV or YAML the distinction is preserved (`@id`), because flattening it away is the change that costs an afternoon later.

Frequently asked questions

What does the validator not cover?

xs:include, xs:import and xs:redefine, substitution groups, xs:key/keyref/unique identity constraints, wildcard namespace control and XSD 1.1 assertions. A document using them may pass here and still be rejected by a full validator — the page lists this rather than burying it.

Why is an element that looks fine reported as unexpected?

Usually ordering: xs:sequence requires the declared order, so two valid elements in the wrong order are a violation. The message names the expected content model, which is the quickest way to see whether the schema or the document is wrong.

Does it fetch the schema from a schemaLocation?

No. A schemaLocation is a hint for a validator that has file or network access; here you paste the schema, and nothing is fetched. That also means no external DTD or schema can be used to make this page make a request on your behalf.

Online