XML

XML validator

Find out whether your XML is well-formed and exactly where it is not. Mismatched closing tags, unescaped characters and extra root elements are reported with positions.

order.xmlDetected: XML ✓
<order id="1">  <item>Book</item>  <item>Pen</order>
✗ line 3: Mismatched closing tag: expected </item> but found </order>

What “well-formed” means

A well-formed XML document has exactly one root element, properly nested and closed tags, quoted attribute values and escaped special characters. DocuFormat’s checker covers the problems that cause real-world parse failures:

  • mismatched closing tags (the error names the tag it expected and the one it found)
  • unescaped & (it must be written &amp;)
  • a literal < in text or attribute values
  • multiple root elements
  • text outside the root element
  • documents with no root element at all

Well-formed is not the same as valid

Validating against a schema (XSD, DTD) is a different job and is not what this tool does. If the XML is well-formed, the XML formatter will indent it for reading.

Getting unstuck

When the cause is not obvious, Explain can describe the problem in plain language, and AI Fix can suggest a corrected document. Both are opt-in; checking is always local.

Questions, answered

Does it check against an XSD or DTD?

No. DocuFormat checks well-formedness only.

Why is a bare & invalid?

In XML, & begins an entity reference. A literal ampersand must be written as &.

Does it change my XML while validating?

No. Validate reports results and leaves your input untouched.

Try the XML formatter on your own input.

Paste it, format it, and fix it if it is broken, once DocuFormat opens.