ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> ruby-talk
ruby-talk
Using hpricot to get tables
by Lrlebron@Gmail.Com other posts by this author
Jul 1 2008 11:10AM messages near this date
Re: capitalize only when 4 or more letters are caps | Re: Using hpricot to get tables
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
Thread:
Lrlebron@Gmail.Com
Dan Diebolt
Lrlebron@Gmail.Com

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved