HTML-TreeBuilder-XPath - I'm having a little problem

Posted on Thu Jul 19 06:20:21 2007 by yeddish
I'm having a little problem
I really love the functionality behind this package. This is what I have been looking for.
The problem that I am having is that anytime I try to access an object any deeper than /html/body it doesn't work. The following code always prints "Doesn't exist":

use HTML::TreeBuilder::XPath; my $tree= HTML::TreeBuilder::XPath->new; $tree->parse_file( "http://moneycentral.msn.com/investor/invsub/results/compare.asp?Page=TenYearSum +mary&Symbol=WHT"); $xpath = '/html/body/div[@id="wrapper"]'; if ($tree->exists($xpath)) { print "$xpath: Exists!\n"; } else { print "$xpath: Doesn't exist!\n"; }

If you could tell me what I am doing wrong it would be greatly appreciated.

Thanks.
-Joel
Direct Responses: 5752 | Write a response