From: David Vallner Date: 2006-12-14T08:28:09+09:00 Subject: Re: Hpricot html parsing --------------enig2794C5B87AD68CF9346CBEC9 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Peter Szinek wrote: > paragraphs =3D doc/'p' >=20 > good_elems =3D paragraphs.map.reject {|elem| ((elem/"img").empty?) } Which once again makes me wish paragraphs =3D doc/'//p[img]/text()' worked. This could be doable if you asked Hpricot to provide you with the REXML document (it's probably out of scope for the intendedly simple XPath engine Hpricot uses natively), but unfortunately I can't for the heck of it figure out how to make REXML accept the final /text(), even though the parser claims to support XPath 1.0 except a few exceptions, that one not being noted. David Vallner --------------enig2794C5B87AD68CF9346CBEC9 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) iD8DBQFFgIyEy6MhrS8astoRAn1VAJ0cxjuJeKzj0kPPb0Oa6zXHlR2cuACfUVAo m1dOyjfNUiBee45Brzgz9Gc= =GjVT -----END PGP SIGNATURE----- --------------enig2794C5B87AD68CF9346CBEC9--