in reply to A puzzle for parsing XML with XML::Simple!
ForceArray won't do it, but all is not lost. Try KeyAttr instead:
my $xml = XML::Simple->new( KeyAttr => [ 'item' ] );
$VAR1 = { 'products' => { 'item' => [ { 'count' => '1', 'name' => 'a', 'price' => '1' }, { 'count' => '1', 'name' => 'b', 'price' => '1' } ] } };
Also, don't forget that even if the parser doesn't give you exactly what you want, there is always post-processing. :-)
HTH
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: A puzzle for parsing XML with XML::Simple!
by ww (Archbishop) on Jan 25, 2008 at 14:24 UTC | |
by bobf (Monsignor) on Jan 25, 2008 at 15:07 UTC |