Nokogiri 1.3.2 Released

nokogiri version 1.3.2 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.

Changes:

1.3.2 / 2009-06-22

  • New Features

    • Nokogiri::XML::DTD#validate will validate your document
  • Bugfixes

    • Nokogiri::XML::NodeSet#search will search top level nodes. GH #73
    • Removed namespace related methods from Nokogiri::XML::Document
    • Fixed a segfault when a namespace was added twice
    • Made nokogiri work with Snow Leopard GH #79
    • Mailing list has moved to:
      http://groups.google.com/group/nokogiri-talk
    • HTML fragments now correctly handle comments and CDATA blocks. GH
      #78
    • Nokogiri::XML::Document#clone is now an alias of dup
  • Deprecations

    • Nokogiri::XML::SAX::Document#start_element_ns is deprecated, please
      switch
      to Nokogiri::XML::SAX::Document#start_element_namespace
    • Nokogiri::XML::SAX::Document#end_element_ns is deprecated, please
      switch
      to Nokogiri::XML::SAX::Document#end_element_namespace

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(‘tenderlove - Google Search’))

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