I had some XML documents that I wanted to edit manually which were generated with all text on one line. The xmllint utility from Gnome's libxml toolkit helps me out:
XMLLINT_INDENT=' ' xmllint --format ugly.xml > pretty.xml