rovf has asked for the wisdom of the Perl Monks concerning the following question:
I have a hash representing an XML structure, where a part of it basically looks like this (I've simplified it a bit):
This structure has been processed by XMLin, using the option forcearray => [ qw(arr subarr) ]. Currently, I'm writing out this structure without any options. XMLout produces the following structure on output:... arr => { elem => [ { mod => 'mstring1', rp => 'rstring1', subarr => { subelem => [ {...}, {...}, ... ] } }, { mod => 'mstring2', rp => 'rstring2', subarr => { subelem => [ {...}, {...}, ... ] } }, } ...
In particular, mod and rp become attributes. Now my question: Is it possible to configure XMLout in a way, so that rp is turned in an attribute, but mod is turned into a element, i.e.... <arr> <elem mod="mstring1" rp="rstring1"> <subarr> <subelem>...</subelem> <subelem>...</subelem> </subarr> </elem> <elem mod="mstring2" rp="rstring2"> <subarr> <subelem>...</subelem> <subelem>...</subelem> </subarr> </elem> ... </arr> ...
Can this be done with XMLout, or is XML::Simple too, eh, simple for this task?... <arr> <elem rp="rstring1"> <mod>mstring1</mod> <subarr> <subelem>...</subelem> <subelem>...</subelem> </subarr> </elem> <elem rp="rstring2"> <mod>mstring2</mod> <subarr> <subelem>...</subelem> <subelem>...</subelem> </subarr> </elem> ... </arr> ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Simple : element vs. attribute in XMLout
by ikegami (Patriarch) on May 26, 2010 at 14:18 UTC | |
by grantm (Parson) on May 26, 2010 at 20:53 UTC | |
|
Re: XML::Simple : element vs. attribute in XMLout
by Krambambuli (Curate) on May 26, 2010 at 13:20 UTC | |
by rovf (Priest) on May 26, 2010 at 13:32 UTC | |
by ikegami (Patriarch) on May 26, 2010 at 14:45 UTC |