Forum: Ruby screen scraping using htmltools and rexml

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
(Guest)
on 2006-01-24 17:42
(Received via mailing list)
Hi,
I need to do some screen scraping and I've spent a couple hour getting
htmltools and rexml do the right thing. Here's the code:

parser = HTMLTree::Parser.new(false, false)
parser.feed(res.body)
tree = parser.tree.html_node.as_rexml_document

I works for one page, but for another I get "undefined method `add' for
#<HTMLTree::Element:0x37f9cc8>" in as_rexml_document

It seems like a library mismatch, but I just downloaded ruby and all
the libraries in the past couple days. Does anybody know what versions
I need to make this work?

Thanks a lot!
Peter
This topic is locked and can not be replied to.