####################################################################################
XML File:
<?xml version='1.0'?>
<apps>
<app name="a" id="a">
</app>
<app name="b" id="b">
</app>
</apps>
####################################################################################
Perl Script:
my $xml = new XML::Simple();
my $data = $xml->XMLin(undef, forcearray => ['blah', 'apps','app',
'name', 'id'] );
print( Dumper($data) );
####################################################################################
Output:
$VAR1 = {
'app' => {
'a' => {
'id' => 'a'
},
'b' => {
'id' => 'b'
}
}
}
####################################################################################
Desired Output:
$VAR1 = {
'app' => [
{
name => 'a',
id => 'a'
},
{
name => 'b',
id => 'b'
}
]
}
You need to change KeyAttr from its default, e.g. KeyAttr => [],
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.