I'm confused about why you want to avoid XML::Generator's auto-escaping of data. Because when you use an XML parser, the data should be auto-unescaped.

Because I'm trying (for lack of a better way of doing it) to insert pre-rolled XML into a larger XML document. Without disabling escaping, I get:

<imageinfo> &lt;imageurl1 /&gt;&lt;imagecaption1 /&gt;&lt;imageurl2 /&gt;&lt;image +caption2 /&gt;&lt;imageurl3 /&gt;&lt;imagecaption3 /&gt;&lt;imageurl4 + /&gt;&lt;imagecaption4 /&gt; </imageinfo>
From:
$generator->imageinfo( $imageSection ),
(remember that $imageSection was generated within a loop). Not a pretty sight, not valid XML ...

I'm also confused about your data format. So am I. It's the requirement from a third party, and cannot be changed. Essentially, I'm trying to work *around* someone else's bizarro-world XML format.


In reply to Re^2: nested loops and escaping in XML::Generator by geektron
in thread nested loops and escaping in XML::Generator by geektron

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.