XML::Simple help

"geek.shrek" <[email protected]>
Newsgroups gmane.comp.lang.perl.xml
Message-ID <[email protected]>
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']);

my $name = $LibList->{'1'}->{name};
print "Customer id " . $name . "\n";

Can someone tell me what did I do wrong?

Thanks,



      __________________________________________________________________________________
Find local businesses and services in your area with Yahoo!7 Local.
Get started: http://local.yahoo.com.au

_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.