
If you want to format the following XML document:
<?xml version="1.0" encoding="UTF-8"?><ROOT><FOO><BAR>Hello World</BAR></FOO><BAR><FOO>World Hello</FOO></BAR></ROOT>
... you can use Vi in combination with Xmllint to do the formatting
$ vi example.xml :%!xmllint --format -
... the result will be:
<?xml version="1.0" encoding="UTF-8"?> <ROOT> <FOO> <BAR>Hello World</BAR> </FOO> <BAR> <FOO>World Hello</FOO> </BAR> </ROOT>
Add new comment