jump to navigation

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>

Comments»

1. adam - July 10, 2009

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.

2. adam - July 10, 2009

crap. sorry, i should have said it works fine, but generates errors.