[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Hpricot Help

Chih-Chao Lam

8/25/2006 6:33:00 PM

Hi,

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>"
=> "<div class=xyz'>abc</div>"
irb(main):002:0> require 'rubygems'; require 'hpricot'
=> true
irb(main):003:0> @doc = Hpricot(html)
=> #<Hpricot::Doc {elem <div class="xyz'"> {text "abc"} </div>}>
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:in `search'
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