in reply to XML tags

You are probably better off going back to the original code that generated the XML in the first place. Fix that code instead of worrying about writing a new program to fix the XML. Once the original code if fixed you can generate the XML once again. This time it will be what you need.

-- vek --