On Sat, Nov 10, 2012 at 05:33:31PM +0000, shawn wilson wrote: > [ ... ] > my $xml_data = <<XML; > <?xml version="1.0" encoding="UTF-8"?> > <TEST xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:noNamespaceSchemaLocation="null.xsd"> > <A> > <B>Find Me</B> > <C>Some Data</C> > </A> > <A> > <B>Leave Me Alone</B> > <C>Unimportant Data</C> > </A> > <A> > <B>Find Me!</B> > <C>Some More Data</C> > </A> > </TEST> > XML > [ ... ] > my $nodes = $doc->findnodes("//*[text()]"); > > my $i = 1; > foreach my $node (@$nodes) { > print $i++ . " [" . $node->textContent . "]\n" if $node->textContent =~ > 'Find Me'; > }
>From the docs: textContent $content = $node->textContent; this function returns the content of all text nodes in the descendants of the given node as specified in DOM. I guess you XPath is wrong, I've changed it to '//*/text()' and the result is the following: 1 [Find Me] 2 [Find Me!] Cheers, Gerhard -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/