If you ever wonder how would you get your messy XML and HTML well-formatted, Here is the whizard, Tidy tidy is a small but very effective tool written by Dave Raggett.
Tidy can clean, indent XML and HTML data very effectively.
tidy -mi -xml file-name
Download the tool, and place the tool in your PATH, so that it can be directly used. Then you can use the tool very effectively.
If you see the screenshot of my vim editor, you'll see we can use Vi's shell command and tidy to modify the file and indent it
The parameters that you see are
- m modify the file
- i indent the file
- xml the input file is XML file
You can exclude the xml parameter if you want to tidy a XHTML or HTML file.
This is not the only thing that Tidy can do, but it will find out errors and warnings in your HTML or XML page.