Forum: Ruby Hpricot 'emptyelem'?

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.
Tim M. (Guest)
on 2009-02-03 23:57
So I require hpricot, open-uri, and net/http in IRB. I type this bit of
doc = Hpricot(open(""))

then I run
images = (doc/"img")

and I get this for images:

#<Hpricot::Elements[{emptyelem <img src="/images/redhanded.gif"
alt="RedHanded">}, {emptyelem <img src="/images/prag-ruby-book.jpg"
alt="PickAxe II">}, {emptyelem <img src="/images/redhanded-duck.gif"
alt="Type the Duck">}, {emptyelem <img src="/images/bubble_icon.gif"
height="20" alt="Get Conversations about RedHanded » sneaking Ruby
through the system" width="24">}, {emptyelem <img
src="/images/hackety-org.png" alt="">}, {emptyelem <img
src="/images/hackety-0.4-err1.png" alt="">}, {emptyelem <img
src="/images/hackety-soda.png" alt="">}, {emptyelem <img
src="/images/hacky-mouse-sketch.png" alt="">}, {emptyelem <img
src="/images/irb-lex.gif" alt="">}, {emptyelem <img
src="/images/gem-mirror-only.gif" alt="">}, {emptyelem <img
src="/images/aside-from-that-there-is-a-range.gif" alt="">}, {emptyelem
<img src="/images/a-personal-expando.png" alt="">}, {emptyelem <img
src="/images/hpricot-aby.png" alt="">}, {emptyelem <img
src="/images/view-as-hpricot.png" alt="">}, {emptyelem <img
src="/images/keepvid.png" alt="">}, {emptyelem <img
src="/images/randfeed.png" alt="">}, {emptyelem <img
src="/images/soundtrack-poster.png" alt="">}]>

Now I want to be able to download all the images from this web page. But
I don't see being able to just go (in psuedo code)

open(images[0], w) do |file|

Because of all the weird 'emptyelem' bits. How do I get around these?
Tim M. (Guest)
on 2009-02-04 00:06
Ok so I fixed the issue.
This topic is locked and can not be replied to.