Ozeroc has asked for the wisdom of the Perl Monks concerning the following question:
When I print the XML I get:use XML::Simple; my $xs = XML::Simple->new( ForceArray => 1, KeepRoot => 1, NoAttr => 1 + ); my $data = { 'Things' => { 'Thing' => [] } }; ... push @{ $data->{Things}->{Thing} }, { 'Item' => $var1, 'Number' => $var2, 'Details' => { 'Detail' => { 'Color' => $var3 } } }; ... my $xml = $xs->XMLout($data); print $xml;
What I'm looking for is:<Things> <Thing> <Item>XXX</Item> <Number>9999</Number> <Details> <name>Detail</name> <Color>Blue</Color> </Details> </Thing> </Things>
This is probably a simple problem and I'm assuming that XML::Simple can't go that deep. Any help is greatly appreciated.<Things> <Thing> <Item>XXX</Item> <Number>9999</Number> <Details> <Detail> <Color>Blue</Color> </Detail> </Details> </Thing> </Things>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Simple and Adding Nested Elements
by psini (Deacon) on May 21, 2008 at 12:50 UTC | |
by Ozeroc (Novice) on May 21, 2008 at 13:07 UTC | |
by psini (Deacon) on May 21, 2008 at 13:16 UTC | |
|
XML::Simple and Adding Additional Nested Elements
by Ozeroc (Novice) on May 23, 2008 at 07:49 UTC | |
by psini (Deacon) on May 23, 2008 at 08:52 UTC | |
by Ozeroc (Novice) on May 23, 2008 at 09:02 UTC | |
by psini (Deacon) on May 23, 2008 at 09:23 UTC | |
by almut (Canon) on May 23, 2008 at 09:29 UTC | |
by psini (Deacon) on May 23, 2008 at 10:06 UTC | |
|