From: Chris Shea Date: 2007-12-19T07:43:48+09:00 Subject: Re: Hpricot syntax different from Xpath ? On Dec 18, 2007 3:34 PM, Celine wrote: > On Dec 18, 11:21 pm, Chris Shea wrote: > > > > > Well, it depends. It'd be helpful to see the page you're working with. > > You might want to try asking the Hpricot mailing list as well (To > > join: Send a message to hpri...@code.whytheluckystiff.net Cc: > > w...@whytheluckystiff.net). > > > > Chris > > Hi Chris, thanks for your answer > Here is the page I'm working with : http://finance.yahoo.com > I want to retrieve value of Nasdaq (up left of the page). I see. It's pretty easy to get using element attributes, which resilient to page changes. If Yahoo decides to add a div in the hierarchy, or add a new exchange, this shouldn't suddenly fail: # assuming doc is the Hpricot object for finance.yahoo.com doc.at('tr[@title="Nasdaq"]/td[2]') Looking at the page source, the span element that contains the value actually has an id (yfs_l10_^ixic), but it doesn't look stable, does it? > I sent the same message on Hpricot ML this afternoon, actually no > answer. I'm on the Hpricot ML and never saw it. Maybe a hiccup somewhere? HTH, Chris