What makes an XML document well-formed?
An XML document is well-formed when it has exactly one root element, every tag is closed and properly nested, attribute values are quoted, and the five special characters are escaped. Being valid is a stronger property: the document also conforms to a schema or DTD. Formatters and validators check the first; contract tools check the second.
Security note: XML parsers that resolve external entities can be made to read local files or call internal URLs (XXE). Disable DTD processing and external entities in any parser that receives untrusted XML.
How to use XML Validator
- Paste the XML document to check.
- Read the result panel: "Well-formed" with a structural summary, or the error with its exact position.
- Use the excerpt to locate the problem, fix it and re-validate (the check re-runs live).
XML Validator features
- Checks well-formedness: matching tags, quoted attributes, single root, valid names
- Reports the error with line and column plus a source excerpt
- Structural summary: root, declaration, encoding, elements, attributes, depth
- Lists distinct element names with counts and declared namespaces
- Warns when no XML declaration or an unusual encoding is declared
- Runs entirely in the browser — nothing is uploaded
XML Validator example
Detect a mismatched closing tag
Input:
<order>
<item>Keyboard</itm>
</order>Output:
Line 2, column 17: Expected closing tag 'item' (opened in line 2, col 3) instead of closing tag 'itm'.Frequently asked questions about XML Validator
What does "well-formed" mean?
Well-formed XML follows the syntax rules: one root element, every tag closed and properly nested, attributes quoted, and no illegal characters. This tool checks well-formedness, not validity against a DTD or XSD schema.
Why does the error point to a different line than I expected?
Parsers report the position where the mismatch is detected, which is often the closing tag rather than the opening one. Check the tag named in the message and its nearest ancestors.
Does it validate against an XSD or DTD?
Not yet — schema validation requires the schema document. The tool does show a structural summary (elements, attributes, namespaces, depth) so you can sanity-check the document shape.
Can I validate SOAP envelopes or RSS feeds?
Yes, any XML dialect works: SOAP, RSS/Atom, SVG, Android layouts, Maven POM files, and so on.
Technical notes
Well-formedness is the syntactic layer of XML. Validity (conformance to a DTD or XSD) is a separate step that requires the schema; this tool focuses on the syntax layer and structure overview.
References
- Extensible Markup Language (XML) 1.0 (Fifth Edition)What makes an XML document well-formed: elements, attributes, entities, character encoding and the prolog.
- OWASP Cheat Sheet Series: XML External Entity PreventionWhy XML parsers must disable external entities and DTDs, and how to configure common parsers safely.