From: Aaron Patterson Date: 2009-03-15T09:43:45+09:00 Subject: [ANN] nokogiri 1.2.2 Released nokogiri version 1.2.2 has been released! * * * * * Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser. Changes: ### 1.2.2 / 2009-03-14 * New features * Nokogiri may be used with soap4r. See XSD::XMLParser::Nokogiri * Nokogiri::XML::Node#inner_html= to set the inner html for a node * Nokogiri builder interface improvements * Nokogiri::XML::Node#swap swaps html for current node (LH #50) * Bugfixes * Fixed a tag nesting problem in the Builder API (LH #41) * Nokogiri::HTML.fragment will properly handle text only nodes (LH #43) * Nokogiri::XML::Node#before will prepend text nodes (LH #44) * Nokogiri::XML::Node#after will append text nodes * Nokogiri::XML::Node#search automatically registers root namepsaces (LH #42) * Nokogiri::XML::NodeSet#search automatically registers namespaces * Nokogiri::HTML::NamedCharacters delegates to libxml2 * Nokogiri::XML::Node#[] can take a symbol (LH #48) * vasprintf for windows updated. Thanks Geoffroy Couprie! * Nokogiri::XML::Node#[]= should not encode entities (LH #55) * Namespaces should be copied to reparented nodes (LH #56) * Nokogiri uses encoding set on the string for default in Ruby 1.9 * Document#dup should create a new document of the same type (LH #59) * Document should not have a parent method (LH #64) ## SUPPORT: The Nokogiri mailing list is available here: * http://rubyforge.org/mailman/listinfo/nokogiri-talk The bug tracker is available here: * http://nokogiri.lighthouseapp.com/projects/19607-nokogiri/overview ## 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 * * * * * -- Aaron Patterson http://tenderlovemaking.com/