Formatting XML for easier reading with Tidy

I've been working on performance tuning a clients application which makes heavy use of XML and in order to get my head around the structure of the XML I wanted to have a browse through the XML data.

So I did a Charles capture of the data to have a look. Unfortunately the data was formatted in a single line with no line breaks and as it was just under 1MB it upset all my usual editors (Eclipse & Gedit) and made them become completely unresponsive.

After a bit of hunting I finally found the right tool for the job - HTML Tidy.

With the following command I was able to get the XML formatted nicely which made my editors play nice and made it a lot easier to get an understanding of the data in the XML packet.

tidy -xml -i input.xml > formatted.xml

This takes the input.xml and indents it nicely and saves it as formatted.xml.

Cheers, Mark

Comments
Have you tried to use HTML Tidy for format CFML code?
# Posted By Mike Henke | 7/13/09 1:26 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.1.004.