Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Perl XML

by ramrod (Curate)
on Aug 13, 2009 at 17:02 UTC ( [id://788383]=note: print w/replies, xml ) Need Help??


in reply to Perl XML

I use XML::LibXML with great results.
Try this (untested):
use XML::LibXML; #Parse XML my $template = 'xmldocument.xml'; my $parser = XML::LibXML->new(); my $doc = $parser->parse_file($template); #Find desired node(s) my @nodes= $doc->findnodes("//genre"); #Put results in array my @information; for(@nodes) { my $data = $_->textContent; push (@information,$data); }
This puts the text from all the "genre" nodes into an array.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://788383]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-18 01:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found