Hpricot and XPaths with indices

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
 
D

David Vallner

--------------enigB790C9C02A6ECA2DCD04C63D
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

http://code.whytheluckystiff.net/hpricot/wiki/SupportedXpathExpressions

Yay rftdocs. Hpricot's XPath syntax seems quite incomplete, either e.g.
div:eq(0) will work or nothing will.

David Vallner



--------------enigB790C9C02A6ECA2DCD04C63D
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)

iD8DBQFFJvqpy6MhrS8astoRAiNUAJ4v1GeX2tZP7u9b/ChXetBmxfjvHwCfQklj
p3SGKnQjShuODIGyoN3e1Zk=
=VoVv
-----END PGP SIGNATURE-----

--------------enigB790C9C02A6ECA2DCD04C63D--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top