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

Re: searching the XML file for certain nodes

by ramrod (Curate)
on Mar 10, 2009 at 14:13 UTC ( #749605=note: print w/replies, xml ) Need Help??


in reply to searching the XML file for certain nodes

If you wanted to use XML::libXML then the following would point you toward the node you want:
my $parser = XML::LibXML->new(); my $doc = $parser->parse_file($data); my ($object) = $doc->findnodes("\/e\/p\[\@v=\"YES\"\]");
Then you can manipulate the rest all you want with the other functions (I would start with childnodes)
Hope this helps!
NOTE: I chose the double quotes in case you wanted to replace YES with a variable. Maybe . . .
my ($object) = $doc->findnodes("\/e\/p\[\@v=\"$criteria\"\]");

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2018-11-16 02:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My code is most likely broken because:
















    Results (193 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!