![]() |
|
Problems? Is your data what you think it is? | |
PerlMonks |
nested loops and escaping in XML::Generatorby geektron (Curate) |
on Jul 12, 2006 at 21:01 UTC ( #560820=perlquestion: print w/replies, xml ) | Need Help?? |
geektron has asked for the wisdom of the Perl Monks concerning the following question:
When I first started looking for XML generation modules, XML::Generator looked like the cleanest, simplest tool for the job: convert a database row (after some data massaging) into an XML document.
Unfortunately, the file I needed to generate has some 250 lines, and my code is almost a method-for-attribute match. While annoying, not the biggest problem with the code. The real problem comes when I need to generate the following "looped" section: XML::Generator can handle that with a simple looping construct wrapped around the calls, i.e.: This generated fragment is added to a larger document later, via:
The problem comes when trying to avoid the native escaping of data. As expected, I can turn off escaping ... but that's not something I feel I should trust. Two generator objects would *help* -- but the larger part of the generation would be forced to *not* use the escaping. I have a feeling there's a much better way of doing this, and I'd rather discover that now before I spend the next N days fighting with the mappings needed with some of the DB columns ... only to 'discover' a better way of generating this later on ...
Back to
Seekers of Perl Wisdom
|
|