Before and after, on a real payload
Here is what an API gateway hands back when a request fails. One line, no breaks.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>Invoice 88214 not found</faultstring></soap:Fault></soap:Body></soap:Envelope>With re-indent on, the same bytes come back as a tree you read top to bottom, and the highlighter separates namespace prefixes, attribute names, and quoted values into three colors.
<soap:Envelopexmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>Invoice 88214 not found</faultstring></soap:Fault></soap:Body></soap:Envelope>Six colors carry the whole scheme: tag names, attribute names, quoted values, comments, CDATA sections, and the declaration at the top. Brackets and equals signs stay dim on purpose, because they add no information once the shape of the document is visible.
How the coloring actually happens
The page runs a small scanner over your text, left to right, one character at a time. It has no idea what your schema says and does not care. It only recognises shapes:
- An opening angle bracket followed by a bang and two dashes starts a comment, which runs until the first closing sequence.
- The nine characters of a CDATA opener switch the scanner into raw mode, where angle brackets inside the block stay content instead of markup.
- A question mark after the bracket marks the declaration or a processing instruction.
- Anything else that opens with a bracket and a letter is a tag, so the scanner reads the name, then walks attribute names, equals signs, and quoted values until the tag closes.
- Text between tags gets one more pass to pick out entity references such as
&andé.
That shape-based approach is why a document with a missing closing tag still comes back in full color. Validation runs separately, through the browser DOM parser, and its verdict shows in the status line and the parser strip. The two are deliberately independent: a highlighter that goes silent on invalid input is useless at the exact moment you reach for it.
The re-indent step is the one place the tool needs a valid document. It walks the parsed tree and prints two spaces per level, keeping comments, CDATA blocks, and processing instructions in place. When the parse fails, indenting is skipped and your text is highlighted as it arrived.
What re-indenting quietly changes
Rewriting whitespace is never free, and you should know what moves before you copy the result back into a file.
- Empty elements come back self closed.
<note></note>prints as<note/>. Equivalent to every XML parser, visibly different in a diff. - Mixed content prints on one line. An element holding both text and child elements keeps its children inline, with runs of spaces and newlines squeezed to one space. That protects the reading order of a paragraph carrying inline markup, at the cost of its original line breaks.
- Entities normalise. The parser decodes
Ato a plain A, and the serializer writes the plain A back. Only the five reserved characters get re-escaped. - Attribute order follows the parser, and single-quoted attribute values come back double quoted.
- An internal DTD subset is dropped. The public and system identifiers on a DOCTYPE line survive, but entity declarations written inside square brackets do not, since browsers keep no access to them.
For an audit trail or a signed document, leave re-indent off. Whitespace inside a signed element is part of what got signed, and reformatting invalidates the signature.
Highlighting is not validation. Colors tell you the document is well formed enough to read. They say nothing about whether <invoice> belongs inside <customer>. No DTD is fetched, no XSD is applied, and no external entity is resolved, which is also what keeps the page safe to paste production data into. When structure is the question rather than legibility, run the file through the XML Parser and read the tree it builds.
Where it runs out of room
Everything happens in your browser tab. Nothing uploads, which is the point when the payload carries customer records, and it also sets the ceiling. Past roughly 5,000 lines the scanner and the line list start feeling heavy, and a 10 MB export will freeze the tab while it renders. Split large files, or highlight the section you actually need to read.
Two more boundaries worth naming. The tool colors XML grammar only, so an XSLT stylesheet or an SVG file highlights correctly as markup but gets no special treatment for its own vocabulary. And it never compares documents: for two versions side by side with the changes marked, the XML Diff tool is the right stop.
