Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2018-06-24 06:03 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.