http://www.perlmonks.org?node_id=757947


in reply to Re^3: Xml::Twig:Xpath Xpath expression error
in thread Xml::Twig:Xpath Xpath expression error

Thank you. I tried that. The returned output is again, as before, a syntax error:
error in xpath expression //OverallConnectionPoolStatus/FlowRater/Name +/text() ar ound text() at D:\Scripts\prun84\test3.pl line 27 at D:\Scripts\prun84\test3.pl line 8 at D:\Scripts\prun84\test3.pl line 8
You said it won't do much, but it shouldn't crash with an error if the expression will return nothing! I think there is a problem somehow with loading the XML::Twig::XPath module, somehow I believe I still using the XML::Twig engine. Can it be ? Just to make sure I attach the full program:
use XML::Twig::XPath; my $t = XML::Twig::XPath->new( twig_roots => { 'BalancerStatus/WebServer/OverallConnectionPoolStatus' => +\&section, #'BalancerStatus/WebServer/BalancerStatus/Server' => \&sec +tion }); $t->parsefile( 'localhost.xml'); # sub section { my ($t, $section) = @_; my $a = $section->get_xpath( q{//OverallConnectionPoolStatus/FlowR +ater/Name/text()} ); $t->purge; }