Retrieve URL from XML

clarabeijing

New Member
I have the following XML -\[code\]<title type="text/html">First part of string</title><content type="text/html"><p>And Second part of string</p> </content><link rel="alternate" type="text/html" href="http://www.FooBar.com"/>\[/code\]And have used the following script in \[code\]XPath\[/code\] -\[code\]use XML::XPath;use XML::XPath::XMLParser;my $file = 'MY.xml';my $xp = XML::XPath->new(filename=>$file);my $body = $xp->findvalue('entry/activity:object/content');print "$body\n";my $title = $xp->findvalue('entry/activity:object/title');print "$title\n";\[/code\]Which returns -\[code\]First part of string And Second part of string\[/code\]I also need it to output the -\[code\]http://www.FooBar.com\[/code\]I tried adding -\[code\]my $URL = $xp->findvalue('entry/activity:object/link');print "$URL\n";\[/code\]But this did not output anything.How can I edit my script to include the URL string?
 
Back
Top