Re: Human readable XML hacks?

From: Eric Lease Morgan <00000107b9c961ae-dmarc-request_at_nyob>
Date: Mon, 30 Mar 2026 14:26:10 -0400
To: CODE4LIB_at_LISTS.CLIR.ORG
On Mar 30, 2026, at 2:14 PM, Canino, Adrienne <Adrienne_at_AXIOMDATASCIENCE.COM> wrote:

> Anyone have a favorite tool for make XML 'render' into a document friendlier for humans to read?
> Latex? Oxygen Editor? Ideally this would be a lightweight tool on a local machine (meaning chromebook friendly) or browser magical widget.
> 
> --
> Adrienne Canino (she/her)
> Data Librarian (MLIS)
> TetraTech Ocean Sciences
> Anchorage, Alaska


Yes, XML can be difficult to read, and, in general, there are two ways to make it more readable: 1) formatting it, and 2) transforming it. The former is relatively easy through the use of a widely available command-line program called xmllint. Try:

  $ xmllint --format <file.xml>

Xmllint will look at your file, verify that it is well-formed (or not), and then collapse and indent things for more easier reading. You can pipe the result through to a pager to see the result one screen at a time, kinda like this:

  $ xmllint --format <file.xml> | less -S

A program called HTML Tidy does much the same thing. [1]

If you want to make your XML really easier to read, then maybe you are wanting to transform the XML into some other format, like HTML, a plain text file, a CSV file, et cetera. If you want to do these sorts of things, then that is something else altogether.

Finally, while searching for Tidy I see there may be more than a handful of Web-based tools to make your XML easier to read. I haven't tried any of them. 


[1] https://www.html-tidy.org/documentation/

--
Eric Morgan <emorgan_at_nd.edu>
Received on Mon Mar 30 2026 - 14:27:20 EDT