Making XML Readable Without Breaking It
By toolbelt maintainers ·
Updated
SOAP responses and legacy exports arrive as one unbroken line. Indenting them reveals the structure — and the problems.
What is this tool?
XML is verbose by nature, and formatters make that obvious. Indenting a document shows you the tree you actually have, rather than the tree you assumed.
How it works
The document is parsed into a tree and re-printed with indentation. Whitespace between elements is not meaningful in XML, so this is safe. Whitespace inside text content is preserved, because there it does matter.
Example
Before:
<soap:Envelope><soap:Body><GetUser><id>42</id><name>Ada</name></GetUser></soap:Body></soap:Envelope>
After:
<soap:Envelope>
<soap:Body>
<GetUser>
<id>42</id>
<name>Ada</name>
</GetUser>
</soap:Body>
</soap:Envelope>When to use it
Any time you inherit an integration. Older systems speak XML, and the response is usually minified by whatever generated it. Also before diffing two XML responses, since a one-line diff is useless.
Optimization Tips
Watch the namespace prefixes. A document can be valid while every prefix is wrong, and the formatted output is where you notice that soap: and ns0: appear where you expected one consistent prefix.
Frequently Asked Questions
Does indenting change the document?
My XML has mixed content and looks wrong now
Why does it fail on an unclosed tag?
Can it handle CDATA?
Related tools
- JSON FormatterBeautify, validate, minify, and view JSON. Format messy API responses into readable code or compress it to save bandwidth, running safely in your browser.
- JSON ValidatorValidate JSON syntax with detailed error messages. Catch trailing commas, missing brackets, and syntax errors instantly before sending payloads to your API.
- JSON MinifierCompress JSON to a single line. Remove all unnecessary whitespace and line breaks to reduce payload size for production APIs without altering the underlying data.
- JSON ViewerView JSON in an interactive, collapsible tree structure. Easily navigate massive API responses, expand specific nodes, and inspect deeply nested objects or arrays.