From: "Jesús Gabriel y Galán" Date: 2010-10-06T16:27:23+09:00 Subject: Re: How can I count number of elements in an HTML page 2010/10/5 Jesús Gabriel y Galán : > On Tue, Oct 5, 2010 at 10:45 PM, Paul wrote: >> Hi there, I'm using net/http to retrieve some html pages and now I >> want to count the number of items in a list on the page.  The >> response.body is stored as a string. >> >> The HTML looks something like this: >> ---- >>
>>  

>>      Section Heading I'm interested in: >>  

>>  
    >>      
  • >>        
    >>           >>        
    >>      
  • >>      
  • >>        
    >>             >>        
    >>      
  • >>  
>>
>> >> irb(main):021:0" END [...snip...] irb(main):034:0> doc.search("/html/body/div/ul/li").size => 2 Hope this helps, Jesus.