leonidlm has asked for the wisdom of the Perl Monks concerning the following question:
Hi All,
I have a strange problem. Please inspect the following code:
error in xpath expression //OverallConnectionPoolStatus/FlowRater[Name= ...
I decided to check this exact expression in the XML::XPath itself, and there, I have no errors, I even get a desired result! I used the following code:
I have a strange problem. Please inspect the following code:
When I run it on an xml file I receive:use XML::Twig::XPath; my $t = XML::Twig->new( twig_roots => { 'BalancerStatus/WebServer/OverallConnectio +nPoolStatus' => \§ion, }); $t->parsefile( 'localhost.xml'); # sub section { my ($t, $section) = @_; print $section->get_xpath( q{//OverallConnectionPoolStatus/FlowRat +er[Name='Total.IncomingReq']} ); $t->purge; }
error in xpath expression //OverallConnectionPoolStatus/FlowRater[Name= ...
I decided to check this exact expression in the XML::XPath itself, and there, I have no errors, I even get a desired result! I used the following code:
Strange! Can someone help ?use XML::XPath; use XML::XPath::XMLParser; my $xp = XML::XPath->new(filename => 'chunk.xml'); my $nodeset = $xp->find( q{//OverallConnectionPoolStatus/FlowRater +[Name='Total.IncomingReq']} ); # find all paragraphs foreach my $node ($nodeset->get_nodelist) { print "FOUND\n\n", XML::XPath::XMLParser::as_string($node), "\n\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Xml::Twig:Xpath Xpath expression error
by mirod (Canon) on Apr 14, 2009 at 11:33 UTC | |
by leonidlm (Pilgrim) on Apr 14, 2009 at 14:01 UTC | |
by ramrod (Curate) on Apr 14, 2009 at 14:36 UTC | |
by leonidlm (Pilgrim) on Apr 16, 2009 at 08:50 UTC | |
Re: Xml::Twig:Xpath Xpath expression error
by ramrod (Curate) on Apr 14, 2009 at 13:42 UTC | |
Re: Xml::Twig:Xpath Xpath expression error
by mirod (Canon) on Apr 14, 2009 at 15:20 UTC | |
by leonidlm (Pilgrim) on Apr 16, 2009 at 10:32 UTC | |
by mirod (Canon) on Apr 16, 2009 at 11:03 UTC | |
by leonidlm (Pilgrim) on Apr 16, 2009 at 11:48 UTC | |
by mirod (Canon) on Apr 16, 2009 at 11:57 UTC | |
|
Back to
Seekers of Perl Wisdom