XML
XML Formatter and Validator
Paste or upload XML to locate parser errors and make nested elements easier to review.
How this tool works
Browser DOM parsing checks well-formedness. Formatting adds indentation around element-only content while leaving mixed text and xml:space=preserve content serialized without inserted whitespace.
This checks XML syntax, not XSD validity. DTD and entity declarations are rejected; indentation can change inter-element whitespace and lexical details, so review documents where whitespace is significant.
Examples
- Format a nested response envelope.
- Catch an unclosed tag.
- Preserve text around inline elements.
Common use cases
Worked synthetic example
Valid example
<order><id>1</id></order>
Expected: Indented order and id elements. Whitespace is added only around element-only content.
Failure or warning to recognize
Invalid/failure example
<order><id>1</order>
Expected: An unclosed id tag produces an XML parser error; no formatted document is returned.