I encountered a strange bug with a Google Maps API application which loaded a set of points and other information from a static XML File. The Application would work beautifully for every browser except for Internet Explorer 6 and 7 (Surprise! Surprise!) where it would simply fail to load any data.
After a bit of Googling I was tipped off to the idea that my XML File could contain non-visible invalid XML Characters. Trying to open the XML file in Internet Explorer confirmed this suspicion as it threw up a rather unhelpful and non-descriptive error. I tried opening the document up in a Hex editor but the document was large and my untrained eye could not locate the problematic character(s) amongst the valid ones. After taking a few excellent suggestions on Twitter I tried opening the file in Altova’s XML Spy didn’t help correct the document as it claimed the document to be “well-formed”. After a little bit of Googling for XML Document Inspection solutions I stumbled upon a newsgroup post mentioning using Dave Raggett‘s excellent HTML Tidy Utility (which can, contrary to it’s name, be used for a lot more than HTML!).
By running the Tidy tool with the command line arguments:
tidy -mi my_broken_xmlfile.xml
This instructs tidy to indent and prettify the xml file (which I would always recommend for any XML File in development) and to modify the original file. In the process of Indenting and Prettifying it removes any invalid characters which make the document invalid. You could also write the Tidy’d XML file to a separate file using the -o output-file option instead. I then used Scooter Software’s fantastic Beyond Compare tool to view the difference(s) between the old and new versions in order to check what changes had been made.
Incidentally, Beyond Compare is an invaluable tool for any developer allowing Both Local and Remote Comparisons, 3 way merging of documents and even folder comparisons (remote or local: very useful for websites).

I am a Delphi Developer, .NET and Web Developer and General Geek. I am an enthusiastic advocate of hobbyist development and in particular tools which allow for hobbyist development. Please have a good look around and enjoy anything that you find useful on this site. 
