radioAe6rt

Using xmllint to format xml

leave a comment »

Long ago I used to use this utility with some frequency to pretty-print xml: xmllint, from the libxml2 project. I mention this here as much to remind myself how to use it as anything else.


$ export XMLLINT_INDENT=" "; xmllint --format foo.xml

where the environment variable XMLLINT_INDENT controls the indentation level. Two spaces are the default.

The utility is available without further ado on later versions of OS X, as well as on a number of Linux distributions, where I suspect it’s almost ubiquitous.

Written by radioae6rt

October 20, 2008 at 9:31 am

Posted in Internet

Tagged with

Leave a Reply