P
Peter Szinek
Hello,
I just started to use HPricot a few days ago (what a cool piece of
software! ;-) so it is possible that I have just overlooked it but I did
not find a way to evaluate XPaths with indices yet. Instead of a general
XPath, e.g.:
(doc/'//div/table/tr/td/img')
I would like to lookup an indexed one:
(doc/'//div[2]/table[3]/tr[2]/td[8]/img[2]').
OK, I guess this is doable by ((doc/'//div)[2]./table)[3]... or
something similar, but is this the only (and accepted) way?
TIA,
Peter
http://www.rubyrailways.com
I just started to use HPricot a few days ago (what a cool piece of
software! ;-) so it is possible that I have just overlooked it but I did
not find a way to evaluate XPaths with indices yet. Instead of a general
XPath, e.g.:
(doc/'//div/table/tr/td/img')
I would like to lookup an indexed one:
(doc/'//div[2]/table[3]/tr[2]/td[8]/img[2]').
OK, I guess this is doable by ((doc/'//div)[2]./table)[3]... or
something similar, but is this the only (and accepted) way?
TIA,
Peter
http://www.rubyrailways.com