On Dec 19, 2007 2:45 PM, Celine <xhanrot / gmail.com> wrote:
> Yes, thanks, it runs.
> There's something I can't understand : in the Xpath expression I
> posted later, when a node has several child DIVs, I access them with
> an index (div[2]...), but in Hpricot syntax, DIVs aren't accessed
> using an index. So, what trick Hpricot uses to locate "the good" div ?

I'm not sure I understand. Hpricot certainly can access elements that way:

doc = Hpricot('<body><div>one</div><div>two</div></body>')

doc.at('body/div[1]').inner_text    # => "one"
doc.at('body/div[2]').inner_text    # => "two"
doc.at('body/div:eq(0)').inner_text # => "one"
doc.at('body/div:eq(1)').inner_text # => "two"

Chris