Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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

by ramrod (Hermit)
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 scrutinizing the Monastery: (13)
As of 2014-10-20 08:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (73 votes), past polls