in reply to XML::Simple parsing into a hash wierd behaviour
If you take a look at the source code for XML::Simple, you will find this line:
my @DefKeyAttr = qw(name key id);,which is a good indication of the reason that XML::Simple behaved the way you observed.
You can fix the issue by passing in the KeyAttr:
my $parser = new XML::Simple(KeyAttr=>""); my $Config = $parser->XMLin("a.xml");
That gives you:
$VAR1 = { 'type' => [ { 'report' => 'Dummy1', 'name' => 'default' }, { 'report' => 'Dummy2', 'name' => 'scenario1' } ] };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: XML::Simple parsing into a hash wierd behaviour
by ikegami (Patriarch) on Apr 20, 2010 at 06:31 UTC | |
by PeterPeiGuo (Hermit) on Apr 20, 2010 at 06:38 UTC | |
by ikegami (Patriarch) on Apr 20, 2010 at 06:44 UTC | |
| |
|
Re^2: XML::Simple parsing into a hash wierd behaviour
by jthomas (Acolyte) on Apr 20, 2010 at 06:35 UTC | |
by PeterPeiGuo (Hermit) on Apr 20, 2010 at 06:55 UTC | |
by ikegami (Patriarch) on Apr 20, 2010 at 07:26 UTC | |
by Anonymous Monk on Apr 20, 2010 at 09:35 UTC |