Re: XML::Simple help
Grant McLean <[email protected]>
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 2009-08-13 at 18:30 -0700, geek.shrek wrote:
> Hi,
>
> I'm trying to extract an element value by using XML Simple
>
> Here's my input xml
>
> <Library>
> <book>
> <id>1</id>
> <name>ABC</name>
> </book>
> <book>
> <id>2</id>
> <name>ABC123</name>
> </book>
> <book>
> <id>3</id>
> <name>ABCDEF</name>
> </book>
> </Library>
>
>
> I'm trying to get the name of id "1"
>
> my $LibList = XMLin('library.xml', forcearray=>1, keyattr => ['id']);
The problem is the forcearray=>1. If you want to use that option you
should give it a list of the elements which should be forced to arrays
because you don't usually want it to apply to all elements.
But really, you'd be better off using a different module. Check out
this article:
http://www.perlmonks.org/index.pl?node_id=490846
Cheers
Grant
_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs