CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
XML::XPath - problem getting the value of a node

 



ChopperCharles
Novice

Oct 4, 2011, 8:22 AM

Post #1 of 1 (481 views)
XML::XPath - problem getting the value of a node Can't Post

I'm a C++/Java/.Net developer. There has got to be a better way to do this in perl:


Code
my $xp = XML::XPath->new($srcXml); 

my $nodeSet = $xp->find('/methodResponse/params/param/value/struct/member');
for (my $idx=1; $idx <= $nodeSet->size(); $idx++) {
print $xp->getNodeText('/methodResponse/params/param/value/struct/member[' . $idx . ']/name'), " = ";
print $xp->getNodeText('/methodResponse/params/param/value/struct/member[' . $idx . ']/value'), "\n";
}


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives