I would like to parse a table using Nokogiri. I\'m doing it this way
def parse_table_nokogiri(html)
doc = Nokogiri::HTML(html)
doc.search(\'table &
ENDHTML
p doc.xpath( '//table/tr/td/text()|//table/tr/td/font/text()' )
#=> [# See XPath with optional element in hierarchy for a more DRY answer. In this case, however, you can simply do: Note that your table structure (and mine above) which does not have an explicit p doc.xpath( '//table/tr/td//text()' )
#=> [#tbody element is invalid for XHTML. Given your explicit table > tr above, however, I assume that you have a reason for this.