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

Posted on Thu Jul 19 08:27:22 2007 by mirod in response to 5751 (See the whole thread of 6)
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