You can use xmllint
to pretty-print ugly XML files on your terminal. Just say:
xmllint --format file.xml
That will restructure containers nicely into individual sections with proper indentation.\
Note that it will automagically work on gzipped XML files!
To write pretty output to a new file, just use the -o
switch (short for --output
):
xmllint --format file.xml -o pretty_file.xml
See the xmllint man page Show archive.org snapshot for other useful switches and more information.
Posted by Arne Hartherz to makandra dev (2013-07-04 09:17)