Hpricot Help


I’m playing around with Hpricot was am wondering if I’m using it
wrongly or have I encountered a bug.

Here’s an irb transcript that shows this:
irb(main):001:0> html = “<div class=xyz’>abc”
=> “<div class=xyz’>abc”
irb(main):002:0> require ‘rubygems’; require ‘hpricot’
=> true
irb(main):003:0> @doc = Hpricot(html)
=> #<Hpricot::Doc {elem

{text “abc”}
irb(main):004:0> @doc.search(’.xyz’)
NoMethodError: undefined method []=' for #<MatchData:0x71b058> from /usr/local/ror/lib/ruby/gems/1.8/gems/hpricot-0.4/lib/ hpricot/traverse.rb:110:insearch’
from (irb):4

I’m trying to get all html elements of the class “xyz” (regardless of
HTML Element tag type).

Looking at line#110 or traverse.rb, it looks like the code is trying
to make an assignment to a MatchData pseudo-array. Is this allowed?

Thanks for any help here and thanks to _why for a fantastic library,

Chao Lam