Have you looked at or attempted to use any of the XML modules? I think a good starting point would be there.
Also, for the XML output have you decided what the output is going to look like (i.e. XML schema/dtd)?..as XML is not freeform like text.
Lastly, the SQL query construct is absolutely horrible, and you should seriously consider refactoring how that's done. Which will greatly aid in making the code less likely to fail in trivial variations in the data, and more flexible and maintainable. Also looks like the input data is of questionable quality. For example a server http response code would be much better to use instead of the human readable response, which differs between web server setups.
Anyway, hope you don't take this personally, as my opinion is just based on the code presented. Which could do with improvement to make it reliable.
the hardest line to type correctly is: stty erase ^H

In reply to Re: saving sql data in xml formatted file by aquarium
in thread saving sql data in xml formatted file by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.