# \[ANN\] nokogiri 1.1.1 Released

**URL:** <https://rubytalk.org/t/ann-nokogiri-1-1-1-released/51160>\
**Category:** ruby-talk\
**Created:** [14 January 2009 20:14 UTC](https://rubytalk.org/t/ann-nokogiri-1-1-1-released/51160 "2009-01-14T20:14:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aaron\_Patterson1](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@Aaron\_Patterson1](https://rubytalk.org/u/Aaron_Patterson1)\
**Post date:** [14 January 2009 20:14 UTC](https://rubytalk.org/t/ann-nokogiri-1-1-1-released/51160/1 "2009-01-14T20:14:26Z")

</div>

nokogiri version 1.1.1 has been released!

\* \<[http://nokogiri.rubyforge.org/](http://nokogiri.rubyforge.org/)\>  
\* \<[http://github.com/tenderlove/nokogiri/wikis](http://github.com/tenderlove/nokogiri/wikis)\>  
\* \<[http://github.com/tenderlove/nokogiri/tree/master](http://github.com/tenderlove/nokogiri/tree/master)\>  
\* \<[http://rubyforge.org/mailman/listinfo/nokogiri-talk](http://rubyforge.org/mailman/listinfo/nokogiri-talk)\>  
\* \<[http://nokogiri.lighthouseapp.com/projects/19607-nokogiri/overview](http://nokogiri.lighthouseapp.com/projects/19607-nokogiri/overview)\>

Nokogiri (��) is an HTML, XML, SAX, and Reader parser.

Changes:

### 1.1.1

\* New features

&nbsp;&nbsp;\* Added XML::Node#elem?  
&nbsp;&nbsp;\* Added XML::Node#attribute\_nodes  
&nbsp;&nbsp;\* Added XML::Attr  
&nbsp;&nbsp;\* XML::Node#delete added.  
&nbsp;&nbsp;\* XML::NodeSet#inner\_html added.

\* Bugfixes

&nbsp;&nbsp;\* Not including an HTML entity for \r for HTML nodes.  
&nbsp;&nbsp;\* Removed CSS::SelectorHandler and XML::XPathHandler  
&nbsp;&nbsp;\* XML::Node#attributes returns an Attr node for the value.  
&nbsp;&nbsp;\* XML::NodeSet implements to\_xml

## FEATURES:

\* XPath support for document searching  
\* CSS3 selector support for document searching  
\* XML/HTML builder  
\* Drop in replacement for Hpricot (though not bug for bug)

Nokogiri parses and searches XML/HTML very quickly, and also has  
correctly implemented CSS3 selector support as well as XPath support.

Here is a speed test:

&nbsp;&nbsp;\* [http://gist.github.com/24605](http://gist.github.com/24605)

Nokogiri also features an Hpricot compatibility layer to help ease the change  
to using correct CSS and XPath.

## SUPPORT:

The Nokogiri mailing list is available here:

&nbsp;&nbsp;\* [http://rubyforge.org/mailman/listinfo/nokogiri-talk](http://rubyforge.org/mailman/listinfo/nokogiri-talk)

The bug tracker is available here:

&nbsp;&nbsp;\* [http://nokogiri.lighthouseapp.com/projects/19607-nokogiri/overview](http://nokogiri.lighthouseapp.com/projects/19607-nokogiri/overview)

## SYNOPSIS:

&nbsp;&nbsp;require 'nokogiri'  
&nbsp;&nbsp;require 'open-uri'  
&nbsp;&nbsp;  
&nbsp;&nbsp;doc = Nokogiri::HTML(open('[http://www.google.com/search?q=tenderlove](http://www.google.com/search?q=tenderlove)'))

> **···**
>
> ####  
> &nbsp;&nbsp;# Search for nodes by css  
> &nbsp;&nbsp;doc.css('h3.r a.l').each do |link|  
> &nbsp;&nbsp;&nbsp;&nbsp;puts link.content  
> &nbsp;&nbsp;end  
> &nbsp;&nbsp;  
> &nbsp;&nbsp;####  
> &nbsp;&nbsp;# Search for nodes by xpath  
> &nbsp;&nbsp;doc.xpath('//h3/a[@class="l"]').each do |link|  
> &nbsp;&nbsp;&nbsp;&nbsp;puts link.content  
> &nbsp;&nbsp;end  
> &nbsp;&nbsp;  
> &nbsp;&nbsp;####  
> &nbsp;&nbsp;# Or mix and match.  
> &nbsp;&nbsp;doc.search('h3.r a.l', '//h3/a[@class="l"]').each do |link|  
> &nbsp;&nbsp;&nbsp;&nbsp;puts link.content  
> &nbsp;&nbsp;end
> 
> ## INSTALL:
> 
> \* sudo gem install nokogiri
> 
> \* \<[http://nokogiri.rubyforge.org/](http://nokogiri.rubyforge.org/)\>  
> \* \<[http://github.com/tenderlove/nokogiri/wikis](http://github.com/tenderlove/nokogiri/wikis)\>  
> \* \<[http://github.com/tenderlove/nokogiri/tree/master](http://github.com/tenderlove/nokogiri/tree/master)\>  
> \* \<[http://rubyforge.org/mailman/listinfo/nokogiri-talk](http://rubyforge.org/mailman/listinfo/nokogiri-talk)\>  
> \* \<[http://nokogiri.lighthouseapp.com/projects/19607-nokogiri/overview](http://nokogiri.lighthouseapp.com/projects/19607-nokogiri/overview)\>
> 
> --  
> Aaron Patterson  
> [http://tenderlovemaking.com/](http://tenderlovemaking.com/)

---

<div class="post-metadata">

**Author:** ![Mark\_Watson](https://avatars.discourse-cdn.com/v4/letter/m/898d66/32.png) [@Mark\_Watson](https://rubytalk.org/u/Mark_Watson)\
**Post date:** [14 January 2009 20:44 UTC](https://rubytalk.org/t/ann-nokogiri-1-1-1-released/51160/2 "2009-01-14T20:44:05Z")

</div>

Thanks Aaron for your work on Nokogiri.

I noticed what looked like JRuby support so I tried installing the gem  
(worked) and then an example that failed:

irb(main):001:0\> require 'nokogiri'  
=\> true  
irb(main):002:0\> require 'open-uri'  
=\> true  
irb(main):003:0\> doc = Nokogiri::HTML(open('[http://markwatson.com](http://markwatson.com)'))  
NoMethodError: undefined method `read\_memory' for  
Nokogiri::HTML::Document:Class  
&nbsp;&nbsp;from /Users/markw/bin/jruby/lib/ruby/gems/1.8/gems/nokogiri-1.1.1-  
java/lib/nokogiri/html.rb:36:in `parse'  
&nbsp;&nbsp;from /Users/markw/bin/jruby/lib/ruby/gems/1.8/gems/nokogiri-1.1.1-  
java/lib/nokogiri/html.rb:15:in `HTML'  
&nbsp;&nbsp;from (irb):4  
&nbsp;&nbsp;from /Users/markw/bin/jruby/lib/ruby/1.8/irb.rb:150:in `eval\_input'

I am using version jruby 1.1.5 - will a later version of JRuby make  
this work?

Thanks,  
Mark

---

<div class="post-metadata">

**Author:** ![Aaron\_Patterson1](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@Aaron\_Patterson1](https://rubytalk.org/u/Aaron_Patterson1)\
**Post date:** [14 January 2009 21:00 UTC](https://rubytalk.org/t/ann-nokogiri-1-1-1-released/51160/3 "2009-01-14T21:00:23Z")

</div>

No. Unfortunately the jruby release is sort of a lie.... It doesn't  
actually work on jruby. I've been releasing a jruby version so that  
webrat can use it's CSS to XPath conversion code, then fall back on  
REXML.

We're working on a better jruby solution though. We've got a branch  
that uses FFI, and Charles Nutter has a branch with a Java  
implementation.

&nbsp;&nbsp;[GitHub - headius/nokogiri: Nokogiri (鋸) is a Rubygem providing HTML, XML, SAX, and Reader parsers with XPath and CSS selector support.](http://github.com/headius/nokogiri/tree/master)

I'm not sure what the status is on his branch.

> **···**
>
> On Thu, Jan 15, 2009 at 05:44:05AM +0900, Mark Watson wrote:
> 
> > Thanks Aaron for your work on Nokogiri.
> > 
> > I noticed what looked like JRuby support so I tried installing the gem  
> > (worked) and then an example that failed:
> > 
> > irb(main):001:0\> require 'nokogiri'  
> > =\> true  
> > irb(main):002:0\> require 'open-uri'  
> > =\> true  
> > irb(main):003:0\> doc = Nokogiri::HTML(open('[http://markwatson.com](http://markwatson.com)'))  
> > NoMethodError: undefined method `read\_memory' for  
> > Nokogiri::HTML::Document:Class  
> > &nbsp;&nbsp;from /Users/markw/bin/jruby/lib/ruby/gems/1.8/gems/nokogiri-1.1.1-  
> > java/lib/nokogiri/html.rb:36:in `parse'  
> > &nbsp;&nbsp;from /Users/markw/bin/jruby/lib/ruby/gems/1.8/gems/nokogiri-1.1.1-  
> > java/lib/nokogiri/html.rb:15:in `HTML'  
> > &nbsp;&nbsp;from (irb):4  
> > &nbsp;&nbsp;from /Users/markw/bin/jruby/lib/ruby/1.8/irb.rb:150:in `eval\_input'
> > 
> > I am using version jruby 1.1.5 - will a later version of JRuby make  
> > this work?
> 
> --  
> Aaron Patterson  
> [http://tenderlovemaking.com/](http://tenderlovemaking.com/)

---

<div class="post-metadata">

**Author:** ![Mark\_Watson](https://avatars.discourse-cdn.com/v4/letter/m/898d66/32.png) [@Mark\_Watson](https://rubytalk.org/u/Mark_Watson)\
**Post date:** [15 January 2009 14:24 UTC](https://rubytalk.org/t/ann-nokogiri-1-1-1-released/51160/4 "2009-01-15T14:24:00Z")

</div>

Thanks Aaron for the update on Charles' and your branches. I am using  
nokogiri in 2 examples in a new Ruby book that I am writing for  
APress; I had a warning about JRuby incompatibility (and have a little  
code using a pure Ruby alternative), but by the time the book is  
published (5 months) it looks like we will have a working version for  
JRuby. I could be of more help with the pure Java version, so I will  
as Charles if he wants help.

> **···**
>
> On Jan 14, 2:00 pm, Aaron Patterson \<aa...@tenderlovemaking.com\> wrote:
> 
> > On Thu, Jan 15, 2009 at 05:44:05AM +0900, Mark Watson wrote:  
> > \> Thanks Aaron for your work on Nokogiri.
> > 
> > \> I noticed what looked like JRuby support so I tried installing the gem  
> > \> (worked) and then an example that failed:
> > 
> > \> irb(main):001:0\> require 'nokogiri'  
> > \> =\> true  
> > \> irb(main):002:0\> require 'open-uri'  
> > \> =\> true  
> > \> irb(main):003:0\> doc = Nokogiri::HTML(open('[http://markwatson.com](http://markwatson.com)'))  
> > \> NoMethodError: undefined method `read\_memory' for  
> > \> Nokogiri::HTML::Document:Class  
> > \> from /Users/markw/bin/jruby/lib/ruby/gems/1.8/gems/nokogiri-1.1.1-  
> > \> java/lib/nokogiri/html.rb:36:in `parse'  
> > \> from /Users/markw/bin/jruby/lib/ruby/gems/1.8/gems/nokogiri-1.1.1-  
> > \> java/lib/nokogiri/html.rb:15:in `HTML'  
> > \> from (irb):4  
> > \> from /Users/markw/bin/jruby/lib/ruby/1.8/irb.rb:150:in `eval\_input'
> > 
> > \> I am using version jruby 1.1.5 - will a later version of JRuby make  
> > \> this work?
> > 
> > No. Unfortunately the jruby release is sort of a lie.... It doesn't  
> > actually work on jruby. I've been releasing a jruby version so that  
> > webrat can use it's CSS to XPath conversion code, then fall back on  
> > REXML.
> > 
> > We're working on a better jruby solution though. We've got a branch  
> > that uses FFI, and Charles Nutter has a branch with a Java  
> > implementation.
> > 
> > [GitHub - headius/nokogiri: Nokogiri (鋸) is a Rubygem providing HTML, XML, SAX, and Reader parsers with XPath and CSS selector support.](http://github.com/headius/nokogiri/tree/master)
> > 
> > I'm not sure what the status is on his branch.
> > 
> > --  
> > Aaron Pattersonhttp://tenderlovemaking.com/
