Nokogiri 1.3.1 Released


#1

nokogiri version 1.3.1 has been released!

Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser. Among Nokogiri’s
many features is the ability to search documents via XPath or CSS3
selectors.

XML is like violence - if it doesn’t solve your problems, you are not
using
enough of it.

SUPPORT:

The Nokogiri mailing list is available here:

The bug tracker is available here:

The IRC channel is #nokogiri on freenode.

SYNOPSIS:

require ‘nokogiri’
require ‘open-uri’

Get a Nokogiri::HTML:Document for the page we’re interested in…

doc =
Nokogiri::HTML(open(‘http://www.google.com/search?q=tenderlove’))

Do funky things with it using Nokogiri::XML::Node methods…

Search for nodes by css

doc.css(‘h3.r a.l’).each do |link|
puts link.content
end

Search for nodes by xpath

doc.xpath(’//h3/a[@class=“l”]’).each do |link|
puts link.content
end

Or mix and match.

doc.search(‘h3.r a.l’, ‘//h3/a[@class=“l”]’).each do |link|
puts link.content
end

REQUIREMENTS:

  • ruby 1.8 or 1.9
  • libxml2
  • libxml2-dev
  • libxslt
  • libxslt-dev

INSTALL:

  • sudo gem install nokogiri

Changes:

1.3.1 / 2009-06-07