in reply to Save results into one big XML file help!

I am wondering why you are not using old school method of writing the data to file using a few print statements of your own!
This may cost you a few extra lines of code, but you will be able to write the file the way you wish!
Sorry if this sounds too naive, or doesn't fit your requirement.

Replies are listed 'Best First'.
Re^2: Save results into one big XML file help!
by roboticus (Chancellor) on Aug 16, 2012 at 13:13 UTC

    cheekuperl:

    ...and chances are, it would be wrong. XML looks much simpler than it actually is.

    I spend most of my @work time working with data interchange with various financial institutions and get to work with 'XML' files all the time. The problem is, they tend to generate it just as you say: with a few print statements. So what happens is we get files that *look* like they should be XML, but fail in one or more ways.

    This is one of the reasons you see websites and databases with text like "<amp;" and such everywhere. Someone doesn't encode properly, someone doesn't decode properly, etc.

    The problem is so common that whenever I get a new XML data feed, the first thing I do is run it through an XML validator. (Of course, when you point out that the file you receive isn't valid XML, they'll adamantly insist that it is. Then you're stuck with the job of trying to get the data into your system without making the data any worse than it already is.)

    For all the problems that XML is supposed to solve, I have more headaches with XML feeds than anything else.

    ...roboticus

    When your only tool is XML, all data interchange problems look like a pain in the ass.