Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Keeping XML structure with XML::Simple

by hbo (Monk)
on Jul 21, 2004 at 04:44 UTC ( #376156=note: print w/ replies, xml ) Need Help??

in reply to Keeping XML structure with XML::Simple

From perldoc XML::Simple

ForceArray => 1 (in) (IMPORTANT!) This option should be set to ’1’ to force nested elements to be represented as arrays even when there is only one. Eg, with ForceArray enabled, this XML: <opt> <name>value</name> </opt> would parse to this: { ’name’ => [ ’value ] } instead of this (the default): { ’name’ => ’value } This option is especially useful if the data structure is likely to be written back out as XML and the default behaviour of rolling single nested elements up into attributes is not desirable.
Setting that option will make it easier to not mangle your XML. But XML::Simple shows its limitations when you try use it to write your XML. It's really best when used as it was originally intended, as a config reader.

Comment on Re: Keeping XML structure with XML::Simple
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://376156]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2015-11-27 11:08 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (724 votes), past polls