Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Getting the XML node containing a search text...

by ramrod (Chaplain)
on Oct 27, 2009 at 14:47 UTC ( #803447=note: print w/ replies, xml ) Need Help??


in reply to Getting the XML node containing a search text...

Using XML::LibXML this works for me

use strict; use XML::LibXML; #Parse XML my $template = 'xmlsample.xml'; my $parser = XML::LibXML->new(); my $doc = $parser->parse_file($template); #Search all text nodes for my $node ($doc->findnodes( '//text()' )) #Print xpaths if criteria matched {my $search = $node->nodeValue; if ($search =~ m/InsertSearchCriteriaHere/) {print $node->nodePath();} }


Comment on Re: Getting the XML node containing a search text...
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2015-07-07 05:58 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 (87 votes), past polls