I'm confused. On more than one aspect of the question.
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.
I'm also confused about your data format. Using imageurl# as tagnames seems to be the equivalent of, well, using $var1, $var2, $var3, etc., and variable names and then trying to access them via eval STRING. Instead, I would expect:
This should make things easier to deal with in many ways. (The number attribute probably shouldn't be there either.)<imageinfo> <image number="1"> <url>http://www.company.com/images/photo1.jpg</url> <caption>Caption 1</caption> </image> <image number="2"> <url>http://www.company.com/images/photo2.jpg</url> <caption>Caption 2</caption> </image> <image number="3"> <url>http://www.company.com/images/photo3.jpg</url> <caption>Caption 3</caption> </image> <image number="4"> <url>http://www.company.com/images/photo4.jpg</url> <caption>Caption 4</caption> </image> </imageinfo>
I'm just not sure why you're doing things this way - both the attempt to bypass escaping, and the data layout.
In reply to Re: nested loops and escaping in XML::Generator
by Tanktalus
in thread nested loops and escaping in XML::Generator
by geektron
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |