nokogiri version 1.1.0 has been released!
- http://nokogiri.rubyforge.org/
- http://github.com/tenderlove/nokogiri/wikis
- http://github.com/tenderlove/nokogiri/tree/master
- http://rubyforge.org/mailman/listinfo/nokogiri-talk
- http://nokogiri.lighthouseapp.com/projects/19607-nokogiri/overview
Nokogiri (��) is an HTML, XML, SAX, and Reader parser.
Changes:
1.1.0
-
New Features
- Custom XPath functions are now supported. See
Nokogiri::XML::Node#xpath - Custom CSS pseudo classes are now supported. See
Nokogiri::XML::Node#css - Nokogiri::XML::Node#<< will add a child to the current node
- Custom XPath functions are now supported. See
-
Bugfixes
- Mutex lock on CSS cache access
- Fixed build problems with GCC 3.3.5
- XML::Node#to_xml now takes an indentation argument
- XML::Node#dup takes an optional depth argument
- XML::Node#add_previous_sibling returns new sibling node.
SYNOPSIS:
require ‘nokogiri’
require ‘open-uri’
doc =
Nokogiri::HTML(open(‘tenderlove - Google Search’))
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