Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re^2: Keeping XML structure with XML::Simple

by chazzz (Pilgrim)
on Jul 21, 2004 at 12:43 UTC ( #376226=note: print w/replies, xml ) Need Help??

in reply to Re: Keeping XML structure with XML::Simple
in thread Keeping XML structure with XML::Simple

Are you happy that 'config' was replaced by 'opt'? If that is not the desired behaviour, instead write,
my $xml = XMLin(..., KeepRoot => 1); print XMLout($xml, KeepRoot => 1);
which would correctly output:
<config ip="" port="12345">
The KeepRoot option tells XML::Simple that your structure already has a root node.

Replies are listed 'Best First'.
Re^3: Keeping XML structure with XML::Simple
by johnnywang (Priest) on Jul 21, 2004 at 16:44 UTC
    Just want to point out that the <timeout> element did not get fold up into attributes in your example is because there are more than one of them, by default if there is only one <timeout>, it will be folded up into an attribute.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2016-10-23 06:10 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (300 votes). Check out past polls.