# \[ANN\] nokogiri 1.4.1 Released

**URL:** <https://rubytalk.org/t/ann-nokogiri-1-4-1-released/56585>\
**Category:** ruby-talk\
**Created:** [11 December 2009 05:32 UTC](https://rubytalk.org/t/ann-nokogiri-1-4-1-released/56585 "2009-12-11T05:32:27Z")\
**Posts on this page:** 8\
**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:** [11 December 2009 05:32 UTC](https://rubytalk.org/t/ann-nokogiri-1-4-1-released/56585/1 "2009-12-11T05:32:27Z")

</div>

Hey everyone! Have you finished your holiday shopping yet? I know I haven't.  
Fortunately for you guys, Mike and I like programming a lot more than  
shopping. I mean, don't get me wrong. I \*love\* shopping for myself, I  
just find shopping for other people to be, well, difficult.

Anyway, let's get down to business:

nokogiri version 1.4.1 has been released!

\* \<[http://nokogiri.org](http://nokogiri.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://groups.google.com/group/nokogiri-talk](http://groups.google.com/group/nokogiri-talk)\>  
\* \<[http://github.com/tenderlove/nokogiri/issues](http://github.com/tenderlove/nokogiri/issues)\>

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.4.1 / 2009/12/10

\* New Features

&nbsp;&nbsp;\* Added Nokogiri::LIBXML\_ICONV\_ENABLED  
&nbsp;&nbsp;\* Alias Node#[] to Node#attr  
&nbsp;&nbsp;\* XML::Node#next\_element added  
&nbsp;&nbsp;\* XML::Node#\> added for searching a nodes immediate children  
&nbsp;&nbsp;\* XML::NodeSet#reverse added  
&nbsp;&nbsp;\* Added fragment support to Node#add\_child, Node#add\_next\_sibling,  
&nbsp;&nbsp;&nbsp;&nbsp;Node#add\_previous\_sibling, and Node#replace.  
&nbsp;&nbsp;\* XML::Node#previous\_element implemented  
&nbsp;&nbsp;\* Rubinius support  
&nbsp;&nbsp;\* Ths CSS selector engine now supports :has()  
&nbsp;&nbsp;\* XML::NodeSet#filter() was added  
&nbsp;&nbsp;\* XML::Node.next= and .previous= are aliases for add\_next\_sibling and  
&nbsp;&nbsp;&nbsp;&nbsp;add\_previous\_sibling. GH #183

\* Bugfixes

&nbsp;&nbsp;\* XML fragments with namespaces do not raise an exception  
&nbsp;&nbsp;&nbsp;&nbsp;(regression in 1.4.0)  
&nbsp;&nbsp;\* Node#matches? works in nodes contained by a DocumentFragment. GH #158  
&nbsp;&nbsp;\* Document should not define add\_namespace() method. GH #169  
&nbsp;&nbsp;\* XPath queries returning namespace declarations do not segfault.  
&nbsp;&nbsp;\* Node#replace works with nodes from different documents. GH #162  
&nbsp;&nbsp;\* Adding XML::Document#collect\_namespaces  
&nbsp;&nbsp;\* Fixed bugs in the SOAP4R adapter  
&nbsp;&nbsp;\* Fixed bug in XML::Node#next\_element for certain edge cases  
&nbsp;&nbsp;\* Fixed load path issue with JRuby under Windows. GH #160.  
&nbsp;&nbsp;\* XSLT#apply\_to will honor the "output method". Thanks richardlehane!  
&nbsp;&nbsp;\* Fragments containing leading text nodes with newlines now parse properly.  
&nbsp;&nbsp;&nbsp;&nbsp;GH #178.

## FEATURES:

\* XPath support for document searching  
\* CSS3 selector support for document searching  
\* XML/HTML builder

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)

## SUPPORT:

The Nokogiri {mailing list}[[http://groups.google.com/group/nokogiri-talk](http://groups.google.com/group/nokogiri-talk)]  
is available here:

&nbsp;&nbsp;\* [http://groups.google.com/group/nokogiri-talk](http://groups.google.com/group/nokogiri-talk)

The {bug tracker}[[http://github.com/tenderlove/nokogiri/issues](http://github.com/tenderlove/nokogiri/issues)]  
is available here:

&nbsp;&nbsp;\* [http://github.com/tenderlove/nokogiri/issues](http://github.com/tenderlove/nokogiri/issues)

The IRC channel is #nokogiri on freenode.

## SYNOPSIS:

&nbsp;&nbsp;require 'nokogiri'  
&nbsp;&nbsp;require 'open-uri'  
&nbsp;&nbsp;  
&nbsp;&nbsp;# Get a Nokogiri::HTML:Document for the page we’re interested in...

&nbsp;&nbsp;doc = Nokogiri::HTML(open('[http://www.google.com/search?q=tenderlove](http://www.google.com/search?q=tenderlove)'))  
&nbsp;&nbsp;  
&nbsp;&nbsp;# Do funky things with it using Nokogiri::XML::Node methods...

> **···**
>
> ####  
> &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
> 
> ## REQUIREMENTS:
> 
> \* ruby 1.8 or 1.9  
> \* libxml2  
> \* libxml2-dev  
> \* libxslt  
> \* libxslt-dev
> 
> ## INSTALL:
> 
> \* sudo gem install nokogiri
> 
> --  
> Aaron Patterson  
> [http://tenderlovemaking.com/](http://tenderlovemaking.com/)

---

<div class="post-metadata">

**Author:** ![Bapabooiee](https://avatars.discourse-cdn.com/v4/letter/b/779978/32.png) [@Bapabooiee](https://rubytalk.org/u/Bapabooiee)\
**Post date:** [11 December 2009 19:55 UTC](https://rubytalk.org/t/ann-nokogiri-1-4-1-released/56585/2 "2009-12-11T19:55:05Z")

</div>

Good to hear mate -- and I have to admit, Nokogiri is quite possibly  
the most elegant XML/HTML parser I've ever used.

Just letting you know your work is thoroughly appreciated.

---

<div class="post-metadata">

**Author:** ![Jeremy\_Henty1](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@Jeremy\_Henty1](https://rubytalk.org/u/Jeremy_Henty1)\
**Post date:** [11 December 2009 21:25 UTC](https://rubytalk.org/t/ann-nokogiri-1-4-1-released/56585/3 "2009-12-11T21:25:05Z")

</div>

+1

I recently needed to script up a web scraper and Nokogiri was the  
hammer that hit the nail of the problem squarely on the head. Thank  
you for an excellent piece of work.

Regards,

Jeremy Henty

> **···**
>
> On 2009-12-11, Bapabooiee \<bapabooiee@gmail.com\> wrote:
> 
> > Good to hear mate -- and I have to admit, Nokogiri is quite possibly  
> > the most elegant XML/HTML parser I've ever used.
> > 
> > Just letting you know your work is thoroughly appreciated.

---

<div class="post-metadata">

**Author:** ![Ryan\_Davis1](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/ryan_davis1/32/1848_2.png) [@Ryan\_Davis1](https://rubytalk.org/u/Ryan_Davis1)\
**Post date:** [11 December 2009 22:11 UTC](https://rubytalk.org/t/ann-nokogiri-1-4-1-released/56585/4 "2009-12-11T22:11:55Z")

</div>

next time I'd suggest using mechanize.

> **···**
>
> On Dec 11, 2009, at 13:25 , Jeremy Henty wrote:
> 
> > On 2009-12-11, Bapabooiee \<bapabooiee@gmail.com\> wrote:
> > 
> > > Good to hear mate -- and I have to admit, Nokogiri is quite possibly  
> > > the most elegant XML/HTML parser I've ever used.
> > > 
> > > Just letting you know your work is thoroughly appreciated.
> > 
> > +1
> > 
> > I recently needed to script up a web scraper and Nokogiri was the  
> > hammer that hit the nail of the problem squarely on the head. Thank  
> > you for an excellent piece of work.

---

<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:** [12 December 2009 18:33 UTC](https://rubytalk.org/t/ann-nokogiri-1-4-1-released/56585/5 "2009-12-12T18:33:42Z")

</div>

Thanks guys! It's good to hear nice things once in a while. 😃

Thanks for using nokogiri, and if you run in to bugs, make sure to  
report them!

> **···**
>
> On Sat, Dec 12, 2009 at 06:25:05AM +0900, Jeremy Henty wrote:
> 
> > On 2009-12-11, Bapabooiee \<bapabooiee@gmail.com\> wrote:  
> > \> Good to hear mate -- and I have to admit, Nokogiri is quite possibly  
> > \> the most elegant XML/HTML parser I've ever used.  
> > \>  
> > \> Just letting you know your work is thoroughly appreciated.
> > 
> > +1
> > 
> > I recently needed to script up a web scraper and Nokogiri was the  
> > hammer that hit the nail of the problem squarely on the head. Thank  
> > you for an excellent piece of work.
> 
> --  
> Aaron Patterson  
> [http://tenderlovemaking.com/](http://tenderlovemaking.com/)

---

<div class="post-metadata">

**Author:** ![Jeremy\_Henty1](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@Jeremy\_Henty1](https://rubytalk.org/u/Jeremy_Henty1)\
**Post date:** [12 December 2009 11:30 UTC](https://rubytalk.org/t/ann-nokogiri-1-4-1-released/56585/6 "2009-12-12T11:30:06Z")

</div>

I'll keep it in mind, thanks. \*sigh\*, so many toys, so little time! 🙂

Jeremy Henty

> **···**
>
> On 2009-12-11, Ryan Davis \<ryand-ruby@zenspider.com\> wrote:
> 
> > On Dec 11, 2009, at 13:25 , Jeremy Henty wrote:
> > 
> > > I recently needed to script up a web scraper and Nokogiri was the  
> > > hammer that hit the nail of the problem squarely on the head. Thank  
> > > you for an excellent piece of work.
> > 
> > next time I'd suggest using mechanize.

---

<div class="post-metadata">

**Author:** ![Bapabooiee](https://avatars.discourse-cdn.com/v4/letter/b/779978/32.png) [@Bapabooiee](https://rubytalk.org/u/Bapabooiee)\
**Post date:** [14 December 2009 22:00 UTC](https://rubytalk.org/t/ann-nokogiri-1-4-1-released/56585/7 "2009-12-14T22:00:09Z")

</div>

You would actually probably want to use a combination of both,  
depending on what you're doing. You could use Mechanize for crawling &  
scraping the site, and then you use Nokogiri to pry the information  
you want out of the markup.

> **···**
>
> On Dec 12, 4:26 am, Jeremy Henty \<onepo...@starurchin.org\> wrote:
> 
> > On 2009-12-11, Ryan Davis \<ryand-r...@zenspider.com\> wrote:
> > 
> > \> On Dec 11, 2009, at 13:25 , Jeremy Henty wrote:
> > 
> > \>\> I recently needed to script up a web scraper andNokogiri was the  
> > \>\> hammer that hit the nail of the problem squarely on the head. Thank  
> > \>\> you for an excellent piece of work.
> > 
> > \> next time I'd suggest using mechanize.
> > 
> > I'll keep it in mind, thanks. \*sigh\*, so many toys, so little time! 🙂
> > 
> > Jeremy Henty

---

<div class="post-metadata">

**Author:** ![Ryan\_Davis1](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/ryan_davis1/32/1848_2.png) [@Ryan\_Davis1](https://rubytalk.org/u/Ryan_Davis1)\
**Post date:** [14 December 2009 22:37 UTC](https://rubytalk.org/t/ann-nokogiri-1-4-1-released/56585/8 "2009-12-14T22:37:08Z")

</div>

mechanize already uses nokogiri.

> **···**
>
> On Dec 14, 2009, at 14:00 , Bapabooiee wrote:
> 
> > On Dec 12, 4:26 am, Jeremy Henty \<onepo...@starurchin.org\> wrote:
> > 
> > > On 2009-12-11, Ryan Davis \<ryand-r...@zenspider.com\> wrote:
> > > 
> > > > On Dec 11, 2009, at 13:25 , Jeremy Henty wrote:
> > > 
> > > > > I recently needed to script up a web scraper andNokogiri was the  
> > > > > hammer that hit the nail of the problem squarely on the head. Thank  
> > > > > you for an excellent piece of work.
> > > 
> > > > next time I'd suggest using mechanize.
> > > 
> > > I'll keep it in mind, thanks. \*sigh\*, so many toys, so little time! 🙂
> > > 
> > > Jeremy Henty
> > 
> > You would actually probably want to use a combination of both,  
> > depending on what you're doing. You could use Mechanize for crawling &  
> > scraping the site, and then you use Nokogiri to pry the information  
> > you want out of the markup.
