Forum: Ruby on Rails screenscraping using htmltools and rexml

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Peter B. (Guest)
on 2006-01-25 17:35
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 =, false)
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?

Btw, the versions I have now are:
htmltools 1.09

And I also tried rexml 3.1.3 and the "stable" version of rexml 2.4.8,
but none of them work.

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