Format XML documents in linux May 24, 2007
Posted by Mayank in ubuntu.trackback
To format xml documents in linux you can use a utility called xmllint.
# set the indent
$> export XMLLINT_INDENT=" "
$> xmllint –format –recover <XML_File_name> > <New_file_name>

Just a note that this won’t work on xhtml files with custom tags as it appears xmllint attempts to validate tag names while parsing.
crap. sorry, i should have said it works fine, but generates errors.