Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Perl XML

by ramrod (Chaplain)
on Aug 13, 2009 at 17:02 UTC ( #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.


Comment on Re: Perl XML
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (18)
As of 2015-07-02 18:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (44 votes), past polls