DTD Validator
Check an XML document against a pasted or inline DTD and report structural violations.
What is DTD Validator?
A DTD validator. DTDs are older than schemas and still everywhere in XML-heavy systems: SOAP WSDLs, publishing pipelines, feed dialects and any document with an internal subset.
How it works
The declarations are parsed from the DTD — element content models, attribute lists with their types and requirement, entities — and each content model is compiled into a matcher over child-name sequences, so sequence, choice, occurrence and mixed content are checked rather than approximated. Attribute values are validated against their declared type, including enumerations, IDs, IDREFs and fixed values, and ID uniqueness is tracked across the whole document.
- 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.
- 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.
- 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
Will it fetch an external DTD?
No. A `<!DOCTYPE order SYSTEM "order.dtd">` is not fetched — that would be a network request made on your behalf. Paste the content of the .dtd instead, or use the DOCTYPE's internal subset, which is picked up automatically.
Why does an attribute value fail when the type is CDATA?
Because CDATA means 'not validated further' — any text is acceptable, including none. If a value is rejected, the declared type is something narrower: NMTOKEN, an enumeration, an ID or a number of tokens. The message names the declared type.
Is a DTD still worth using in 2026?
For new designs, no: XSD or RELAX NG express more and DTDs have XML-entity behaviour you must disable. They remain relevant because a great deal of existing data ships with one, and because the same DOCTYPE that declares nice entities is the vector the XXE checker looks for.