Posted on 2007-07-19 05:27:22-07 by mirod in response to 5751
Re: I'm having a little problem

parse_file doesn't do what you think it does. Instead it does what it says, it parses a file ;--). So HTML::TreeBuilder::XPath looks for a file named 'http://moneycentral.msn.com/investor/invsub/results/compare.asp?Page=TenYearSum' and doesn't find it, hence returning a quasi empty tree (the html, head and body elements).

You need to load the HTML yourself, for example by using LWP::Simple, and doing this:

tree->parse_file( get "http://moneycentral.msn.com/investor/invsub/results/compare.asp?Page=TenYear +Summary&Symbol=WHT");

Does this help?

Direct Responses: 5755 | 5760 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.