From: Aaron Patterson Date: 2010-08-12T09:41:46+09:00 Subject: Re: Nokogiri help --zhXaljGHf11kAtnf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 09, 2010 at 01:02:33PM +0900, R.. Kumar 1.9.1 OSX wrote: > Mike Dalessio wrote: > > On Sun, Aug 8, 2010 at 11:35 AM, R.. Kumar 1.9.1 OSX=20 > > >> wrote: > >=20 > >=20 > > For advanced usage like capturing attribute values in a Nokogiri search= ,=20 > > you > > should use Node#xpath: > >=20 > > doc =3D Nokogiri::HTML(open('http://www.reddit.com/r/programming/')) > > puts doc.xpath("//p[@class=3D'nextprev']/a/@href").inspect > > # =3D> [# > http://www.reddit.com/r/programming/?count=3D25&after=3Dt3_cygpc">] >=20 > thanks a lot to both answers. >=20 > 1) Is there any doc that has advanced info or examples, the tutorial had= =20 > simple examples. Nokogiri follows the XPath 1.0 spec. That means any XPath knowledge you gain can be used with Nokogiri. I suggest starting here: http://www.w3schools.com/xpath/ Once you've mastered that, then I would go here: http://www.w3.org/TR/xpath/ =20 > 2) Also, is Nokogiri the right tool for this job, or is Scrubyt more=20 > suitable. Nokogiri will probably work well for you, but I am not an expert with Scrubyt. You may want to investigate. --=20 Aaron Patterson http://tenderlovemaking.com/ --zhXaljGHf11kAtnf Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) iQEcBAEBAgAGBQJMY0NEAAoJEJUxcLy0/6/GeDcH/R+k3Wk36QzuXoSR9DHw9SOK r/xsRm/OTPL7Icn7KcXYIWbpYIpT0RXiW1120ts14C7/9fVa6QDwJqipwBh7+J+u yCMnUsRFUQLjjvzHA+coWg9nt4nSelTEs2azujqiO2N+jvNRNE7RCgtclohLEPpI EslWndSSyVod38zVLesgTF09qJ3wqn7EQQvoQ6/RnWP1YwfGafLg0gKDPsH4fK7a 44anGvjAjwuBwCamvsdmVUetqq7meZzLg/QrPIEpdqiHwfP0tPk0okAK6ahhojkT aH16fIRnpJ7Q3PtfMbELbCLW8rUuiAeygihiFNw8nbaqsE13KEl4OeB2Rk4RCVY= =o3f4 -----END PGP SIGNATURE----- --zhXaljGHf11kAtnf--