L
lrlebron
I am working with the following script to parse a page
require 'hpricot'
require 'open-uri'
strLink ="http://www.sportsline.com/mlb/gamecenter/boxscore/
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
require 'hpricot'
require 'open-uri'
strLink ="http://www.sportsline.com/mlb/gamecenter/boxscore/
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