[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Using hpricot to get tables

lrlebron@gmail.com

7/1/2008 6:06:00 PM

I am working with the following script to parse a page

require 'hpricot'
require 'open-uri'

strLink ="http://www.sportsline.com/mlb/gamecenter...
MLB_20080331_ARI@CIN"
strPath ="div[@class=SLTables1]/div"

@doc = Hpricot(open(strLink))

@doc.search(strPath) do |div|
puts div.inner_html
# puts div.css_path
# puts div.xpath
# puts
puts
end


This prints 4 tables to the screen

<table> blah, blah, blah </table>

<table> blah, blah, blah </table>

<table> blah, blah, blah </table>

<table> blah, blah, blah </table>


I would like to access each table individually. How can I do that?

Thanks,

Luis