Making an XML file readable on paper
XML is written for programs. Opened as it arrives, it is often one enormous line, or indented with a mix of tabs and spaces that falls apart on paper. A PDF listing puts each element on its own line, nested under its parent, so a reviewer, an auditor or a colleague without an editor can follow it page by page.
Updated
Which tool you need
An e-invoice or a feed someone has to check by eye
Turn on line numbers, so a question about the file can point at a line instead of describing where something is.
A file that may be broken
Convert it anyway. The listing still comes out, and the fault is named above it, which is often the quickest way to find a missing closing tag.
The same data arrives as JSON
JSON to PDF lays out a JSON file the same way, and can set a list of records as a table.
Elements with long runs of text
Choose landscape or a smaller text size. Long text breaks onto the next line rather than running off the edge of the page.
Why the file is listed rather than styled
An XML file can name a stylesheet that turns it into a formatted document, an invoice laid out as an invoice for example. Applying one means running instructions the file points to, often fetched from somewhere else, so this tool does neither: what you get is the file itself, made legible.
That is usually what printing XML is for. The question is what the file actually says, not how another program would have shown it, and a listing answers it without hiding a single attribute.
How the XML listing is laid out
Every line is set in Courier on a lightly shaded ground, and there is no font to choose: indentation only lines up when every character is the same width. Each level of nesting is indented two spaces, up to 32 levels, past which deeper lines stay at that depth. Text of up to 120 characters that is an element's only content stays on the element's line; anything longer goes on its own line, one level in.
Runs of spaces and line breaks inside an element's text are collapsed to single spaces, so text whose layout mattered in the file reads as one paragraph in the PDF. Comments and CDATA sections keep their line breaks but lose their indentation.
How the fault at the top is found
Three things are checked as the file is listed: a tag that is never closed, a closing tag whose name does not match the element still open, and an element left open at the end. When all three pass, your browser's own XML reader reads the file too, and catches what they cannot, such as an ampersand that should have been written &.
Only the first fault is named. Once it is fixed in the file, converting again names the next one, if there is one, so a file with several mistakes is mended one at a time.
What to know before you start
- The PDF shows the markup, not the document a stylesheet would produce.
- Tags, attributes and text are all set in one color.
- Characters beyond the chosen Fonts level, and every emoji, come out as a replacement mark.