Forum: Ruby nokogiri 1.3.0 Released

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Aaron P. (Guest)
on 2009-05-31 01:11
(Received via mailing list)
nokogiri version 1.3.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://github.com/tenderlove/nokogiri/issues>

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

Changes:

### 1.3.0 / 2009-05-30

* New Features

  * Builder changes scope based on block arity
  * Builder supports methods ending in underscore similar to tagz
  * Nokogiri::XML::Node#<=> compares nodes based on Document position
  * Nokogiri::XML::Node#matches? returns true if Node can be found with
    given selector.
  * Nokogiri::XML::Node#ancestors now returns an Nokogiri::XML::NodeSet
  * Nokogiri::XML::Node#ancestors will match parents against optional
selector
  * Nokogiri::HTML::Document#meta_encoding for getting the meta encoding
  * Nokogiri::HTML::Document#meta_encoding= for setting the meta
encoding
  * Nokogiri::XML::Document#encoding= to set the document encoding
  * Nokogiri::XML::Schema for validating documents against XSD schema
  * Nokogiri::XML::RelaxNG for validating documents against RelaxNG
schema
  * Nokogiri::HTML::ElementDescription for fetching HTML element
descriptions
  * Nokogiri::XML::Node#description to fetch the node description
  * Nokogiri::XML::Node#accept implements Visitor pattern
  * bin/nokogiri for easily examining documents (Thanks Yutaka HARA!)
  * Nokogiri::XML::NodeSet now supports more Array and Enumerable
operators:
    index, delete, slice, - (difference), + (concatenation), &
(intersection),
    push, pop, shift, ==
  * Nokogiri.XML, Nokogiri.HTML take blocks that receive
    Nokogiri::XML::ParseOptions objects
  * Nokogiri::XML::Node#namespace returns a Nokogiri::XML::Namespace
  * Nokogiri::XML::Node#namespace= for setting a node's namespace
  * Nokogiri::XML::DocumentFragment and Nokogiri::HTML::DocumentFragment
    have a sensible API and a more robust implementation.
  * JRuby 1.3.0 support via FFI.

* Bugfixes

  * Fixed a problem with nil passed to CDATA constructor
  * Fragment method deals with regular expression characters
    (Thanks Joel!) LH #73
  * Fixing builder scope issues LH #61, LH #74, LH #70
  * Fixed a problem when adding a child could remove the child namespace
LH#78
  * Fixed bug with unlinking a node then reparenting it. (GH#22)
  * Fixed failure to catch errors during XSLT parsing (GH#32)
  * Fixed a bug with attribute conditions in CSS selectors (GH#36)
  * Fixed intolerance of HTML attributes without values in
Node#before/after/inner_html=. (GH#35)

* <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://github.com/tenderlove/nokogiri/issues>
Roger P. (Guest)
on 2009-05-31 01:43
Aaron P. wrote:
> nokogiri version 1.3.0 has been released!

Cool. Any instructions on how to install that in windows?
-=r
Aaron P. (Guest)
on 2009-05-31 02:32
(Received via mailing list)
On Sun, May 31, 2009 at 06:43:05AM +0900, Roger P. wrote:
> Aaron P. wrote:
> > nokogiri version 1.3.0 has been released!
>
> Cool. Any instructions on how to install that in windows?

gem install nokogiri

The mirrors probably aren't updated yet.
Iii I. (Guest)
on 2009-05-31 03:37
> gem install nokogiri
>
> The mirrors probably aren't updated yet.

But it still doesn't work under mingw version of Ruby 1.9.1. It's very
frustrated when you need testing app using webrat :-|...
Charles Oliver N. (Guest)
on 2009-05-31 14:08
(Received via mailing list)
Congratulations on the JRuby support! Nokogiri has to be one of the #1
most requested items for us. And hopefully over the summer we'll get a
Java+Ruby(+ no C at all) version released too!
Aaron P. (Guest)
on 2009-05-31 16:52
(Received via mailing list)
On Sun, May 31, 2009 at 08:37:54AM +0900, Iii Iii wrote:
> > gem install nokogiri
> >
> > The mirrors probably aren't updated yet.
>
> But it still doesn't work under mingw version of Ruby 1.9.1. It's very
> frustrated when you need testing app using webrat :-|...

Do you mind expanding on this?  I tested it with that particular version
of ruby on windows, so I'm surprised it doesn't work.  As of 1.3.0, we
support that version, so if it doesn't work, I consider that a bug.
Philip R. (Guest)
on 2009-05-31 18:48
(Received via mailing list)
People,

I had problems getting v1.2.3 installed so for this version I firstly
uninstalled the previous version.  This time the gem install went OK and
"gem list" gives:

   nokogiri (1.3.0)

but when I run the demo program I get:

   ./t095.rb:3:in `require': no such file to load -- nokogiri
(LoadError)

and the same from irb:

   irb
   irb(main):001:0> require 'nokogiri'
   LoadError: no such file to load -- nokogiri
         from (irb):1:in `require'
         from (irb):1

What now?

Thanks,

Phil.


On 2009-05-31 07:10, Aaron P. wrote:
> Changes:
>    * Nokogiri::XML::Node#ancestors now returns an Nokogiri::XML::NodeSet
>    * Nokogiri::XML::NodeSet now supports more Array and Enumerable operators:
> * Bugfixes
>
> *<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://github.com/tenderlove/nokogiri/issues>
>

--
Philip R.

GPO Box 3411
Sydney NSW  2001
Australia
E-mail:  removed_email_address@domain.invalid
Michael G. (Guest)
on 2009-05-31 20:43
(Received via mailing list)
On Sun, May 31, 2009 at 10:47 AM, Philip R. 
<removed_email_address@domain.invalid>
wrote:
>  ./t095.rb:3:in `require': no such file to load -- nokogiri (LoadError)
>
require 'rubygems'
require 'nokogiri'

Did you try that?

Best,
Michael G.
Philip R. (Guest)
on 2009-05-31 20:50
(Received via mailing list)
Michael,


On 2009-06-01 02:42, Michael G. wrote:
>>
>> What now?
>>
>
> require 'rubygems'
> require 'nokogiri'
>
> Did you try that?


That works - thanks! - shouldn't the line "require 'rubygems'" be in the
example code on:

  http://nokogiri.rubyforge.org/nokogiri/

?

Regards,

Phil.
--
Philip R.

GPO Box 3411
Sydney NSW  2001
Australia
E-mail:  removed_email_address@domain.invalid
Eric H. (Guest)
on 2009-06-01 01:49
(Received via mailing list)
On May 31, 2009, at 12:49, Philip R. wrote:
> On 2009-06-01 02:42, Michael G. wrote:
>> require 'rubygems'
>> require 'nokogiri'
>>
>> Did you try that?
>
>
> That works - thanks! - shouldn't the line "require 'rubygems'" be in
> the example code

It should be self-evident that if you install software using RubyGems
you need to load RubyGems to use that software
Tim H. (Guest)
on 2009-06-01 01:52
(Received via mailing list)
Eric H. wrote:
> It should be self-evident that if you install software using RubyGems
> you need to load RubyGems to use that software

+1. We probably should have T-shirts printed up that say that.
Phlip (Guest)
on 2009-06-01 01:56
(Received via mailing list)
Philip R. wrote:

>> require 'rubygems'
>> require 'nokogiri'

> That works - thanks! - shouldn't the line "require 'rubygems'" be in the
> example code on:
>
>   http://nokogiri.rubyforge.org/nokogiri/

Yes, but that's a FAQ for every ruby gem out there. The root
documentation for
all gems should contain that line, but El Goog will always be able to
help if
they don't.
Bil K. (Guest)
on 2009-06-01 14:34
(Received via mailing list)
Eric H. wrote:
> On May 31, 2009, at 12:49, Philip R. wrote:
>> That works - thanks! - shouldn't the line "require 'rubygems'" be in
>> the example code
>
> It should be self-evident that if you install software using RubyGems
> you need to load RubyGems to use that software

It might be, but I get tripped up by "require 'rubygems'" every few
months anyway.

When can RubyGems merge with Ruby?  Or can't it?

Later,
Iii I. (Guest)
on 2009-06-01 15:03
> Do you mind expanding on this?  I tested it with that particular version
> of ruby on windows, so I'm surprised it doesn't work.  As of 1.3.0, we
> support that version, so if it doesn't work, I consider that a bug.
Of course...

gem install nokogiri -> failed

I copied libxml, libxslt*  to ruby installation manually.

c:\gem install nokogiri
Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

c:/ruby/bin/ruby.exe extconf.rb
checking for iconv.h in
/opt/local/include/,/opt/local/include/libxml2,/opt/local/include,c:/ruby/include/libxml2,c:/ruby/include,/usr/local/include/libxml2,/usr/include/libxml2...
yes
checking for libxml/parser.h in
/opt/local/include/,/opt/local/include/libxml2,/opt/local/include,c:/ruby/include/libxml2,c:/ruby/include,/usr/local/include/libxml2,/usr/include/libxml2...
yes
checking for libxslt/xslt.h in
/opt/local/include/,/opt/local/include/libxml2,/opt/local/include,c:/ruby/include/libxml2,c:/ruby/include,/usr/local/include/libxml2,/usr/include/libxml2...
yes
checking for libexslt/exslt.h in
/opt/local/include/,/opt/local/include/libxml2,/opt/local/include,c:/ruby/include/libxml2,c:/ruby/include,/usr/local/include/libxml2,/usr/include/libxml2...
yes
checking for xmlParseDoc() in -lxml2... no
libxml2 is missing.  try 'port install libxml2' or 'yum install libxml2'
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

gem install nokogiri -s http://tenderlovemaking.com/ -> failed
c:\>gem install nokogiri -s http://tenderlovemaking.com/
ERROR:  Error installing nokogiri:
        nokogiri requires Ruby version ~> 1.8.0

I tried to use rake-compiler on OpenSUSE and Debian with Ruby 1.9.1 (in
system) and it failed on frex error. I tried to use it again with Ruby
1.8 (in system). Nokogiri didn't find ruby header files (I installed
every ruby dev package)

* http://www.zlatkovic.com/pub/libxml/

The result is the nokogiri is impossible to install on Windows with Ruby
1.9.1. Yeah, I'm not a rocket scientist :(
Florian G. (Guest)
on 2009-06-01 15:17
(Received via mailing list)
On Jun 1, 2009, at 12:30 PM, Bil K. wrote:

> When can RubyGems merge with Ruby?  Or can't it?
>
> Later,
> --
> Bil K.
> http://fun3d.larc.nasa.gov

It is in 1.9.

For Ruby 1.8, setting the environment variable RUBY_OPTS to "-
rubygems" pretty much does what you want.

Regards,
Florian G.

--
Florian G.

smtp:   removed_email_address@domain.invalid
jabber: removed_email_address@domain.invalid
gpg:    533148E2
Roger P. (Guest)
on 2009-06-01 17:48
> Do you mind expanding on this?  I tested it with that particular version
> of ruby on windows, so I'm surprised it doesn't work.  As of 1.3.0, we
> support that version, so if it doesn't work, I consider that a bug.

no windows love for me, even with 1.8.6

d:\dev>ruby -v
ruby 1.8.6 (2009-03-31 patchlevel 368) [i386-mingw32]

d:\dev>gem install nokogiri
Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
        ERROR: Failed to build gem native extension.


d:\dev>gem install nokogiri --platform=mswin32
Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
        ERROR: Failed to build gem native extension.
Aaron P. (Guest)
on 2009-06-01 19:06
(Received via mailing list)
On Mon, Jun 01, 2009 at 08:03:51PM +0900, Iii Iii wrote:
> Building native extensions.  This could take a while...
> ERROR:  Error installing nokogiri:
>     ERROR: Failed to build gem native extension.

Okay.  It shouldn't try to compile anything.  I will take a look because
this should "just work".
Aaron P. (Guest)
on 2009-06-01 20:08
(Received via mailing list)
On Mon, Jun 01, 2009 at 10:48:08PM +0900, Roger P. wrote:
> d:\dev>gem install nokogiri
> Building native extensions.  This could take a while...
> ERROR:  Error installing nokogiri:
>         ERROR: Failed to build gem native extension.
>
>
> d:\dev>gem install nokogiri --platform=mswin32
> Building native extensions.  This could take a while...
> ERROR:  Error installing nokogiri:
>         ERROR: Failed to build gem native extension.

Hi!  It should be working now.  I accidentally messed up the gem spec
platform string.  I've uploaded a new gem to rubyforge, and was able to
install it on windows.

Let me know how this one works out!
Iii I. (Guest)
on 2009-06-01 20:51
> Hi!  It should be working now.  I accidentally messed up the gem spec
> platform string.  I've uploaded a new gem to rubyforge, and was able to
> install it on windows.
>
> Let me know how this one works out!

c:\>ruby -v
ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mingw32]

c:\>gem install nokogiri
Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
        ERROR: Failed to build gem native extension.

c:\>gem install nokogiri --platform=mswin32
Successfully installed nokogiri-1.3.0-x86-mswin32
1 gem installed
Installing ri documentation for nokogiri-1.3.0-x86-mswin32...
Updating class cache with 2372 classes...
Installing RDoc documentation for nokogiri-1.3.0-x86-mswin32...

c:\>irb
irb(main):001:0> require 'nokogiri'
LoadError: 127: -
c:/ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.3.0-x86-mswin32/lib/nokogiri/1.9/nokogiri.so
    from
c:/ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.3.0-x86-mswin32/lib/nokogiri/nokogiri.rb:1:in
`require'
    from
c:/ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.3.0-x86-mswin32/lib/nokogiri/nokogiri.rb:1:in
`<top (required)>'
    from
c:/ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.3.0/lib/nokogiri.rb:12:in
`require'
    from
c:/ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.3.0/lib/nokogiri.rb:12:in
`<top (required)>'
    from (irb):1:in `require'
    from (irb):1
    from c:/ruby/bin/irb.bat:20:in `<main>'
irb(main):002:0>

I have localized Windows so I can't send exact message in a popup window
but there was something like:

Input point of the procedure DllMain@12 hasn't succeeded find the
dynamic library msvcrt-ruby191.dll.

I think there is conflict between mingw and mswin version of Ruby.
Aaron P. (Guest)
on 2009-06-01 21:08
(Received via mailing list)
On Tue, Jun 02, 2009 at 01:51:22AM +0900, Iii Iii wrote:
> Building native extensions.  This could take a while...
> c:\>irb
> c:/ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.3.0/lib/nokogiri.rb:12:in
> but there was something like:
>
> Input point of the procedure DllMain@12 hasn't succeeded find the
> dynamic library msvcrt-ruby191.dll.
>
> I think there is conflict between mingw and mswin version of Ruby.

Can you point me to the 1.9.1 version you installed?  I will install it
and see if I can debug it.  Nokogiri is cross compiled with mingw, so
I'm surprised it isn't working.
Iii I. (Guest)
on 2009-06-01 21:28
> Can you point me to the 1.9.1 version you installed?  I will install it
> and see if I can debug it.  Nokogiri is cross compiled with mingw, so
> I'm surprised it isn't working.

Of course, I posted it in the previous post but here it's again

c:\>ruby -v
ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mingw32]
Roger P. (Guest)
on 2009-06-01 21:36
Iii Iii wrote:
>> Can you point me to the 1.9.1 version you installed?  I will install it
>> and see if I can debug it.  Nokogiri is cross compiled with mingw, so
>> I'm surprised it isn't working.
>
> Of course, I posted it in the previous post but here it's again
>
> c:\>ruby -v
> ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mingw32]

Interesting.
For me it works fine with mingw 1.8.6, and with mingw 1.9.1:

ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mingw32]
c:\>gem install nokogiri --platform=mswin32
C:\>irb
irb(main):001:0> require 'nokogiri'
LoadError: no such file to load -- nokogiri/native
        from
c:/ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.2.3/lib/nokogiri.rb:6:in
`require'
        from
c:/ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.2.3/lib/nokogiri.rb:6:in
`<top (required)>'
        from (irb):1:in `require'
        from (irb):1
        from c:/ruby/bin/irb:12:in `<main>'

which is different.
-=r
Iii I. (Guest)
on 2009-06-01 21:40
> ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mingw32]
> c:\>gem install nokogiri --platform=mswin32

You have 1.2.3, I have the last 1.3.0 :).
Aaron P. (Guest)
on 2009-06-01 21:45
(Received via mailing list)
On Tue, Jun 02, 2009 at 02:30:07AM +0900, Iii Iii wrote:
> > Can you point me to the 1.9.1 version you installed?  I will install it
> > and see if I can debug it.  Nokogiri is cross compiled with mingw, so
> > I'm surprised it isn't working.
>
> Of course, I posted it in the previous post but here it's again
>
> c:\>ruby -v
> ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mingw32]

No, I mean where did you get it?  I would like to download what you
have.

Sorry if this is an obvious question, but I don't develop on windows and
I want to make sure I'm running the exact same thing you are.
Eric H. (Guest)
on 2009-06-01 21:54
(Received via mailing list)
On Jun 1, 2009, at 03:30, Bil K. wrote:
> When can RubyGems merge with Ruby?  Or can't it?
RubyGems was merged for 1.9
Iii I. (Guest)
on 2009-06-01 22:51
>
> No, I mean where did you get it?  I would like to download what you
> have.
>
> Sorry if this is an obvious question, but I don't develop on windows and
> I want to make sure I'm running the exact same thing you are.
I'm sorry for it, I compiled own version using Rubyinstaller:
http://github.com/oneclick/rubyinstaller/tree/master

Only different is I used gcc 4.3.3 from this page:
http://sourceforge.net/projects/tdm-gcc/
Aaron P. (Guest)
on 2009-06-02 01:19
(Received via mailing list)
On Tue, Jun 02, 2009 at 03:53:22AM +0900, Iii Iii wrote:
> http://sourceforge.net/projects/tdm-gcc/
I think I've got it working now.  The issue is that I was cross
compiling and testing against 1.9.1-p0.  I've updated to 1.9.1-p129 and
things seem to be working now:

  http://skitch.com/aaron.patterson/b1qq6/microsoft-windows-xp
Iii I. (Guest)
on 2009-06-02 01:44
> I think I've got it working now.  The issue is that I was cross
> compiling and testing against 1.9.1-p0.  I've updated to 1.9.1-p129 and
> things seem to be working now:
>
>   http://skitch.com/aaron.patterson/b1qq6/microsoft-windows-xp

I must appreciate your help. I hope future releases will be without any
problem with Windows. Thanks again! :)
Iii I. (Guest)
on 2009-06-02 01:48
> I think I've got it working now.  The issue is that I was cross
> compiling and testing against 1.9.1-p0.  I've updated to 1.9.1-p129 and
> things seem to be working now:
>
>   http://skitch.com/aaron.patterson/b1qq6/microsoft-windows-xp

+ webrat seems to be OK with this version of Nokogiri. The same behavior
like on Linux :)
Luis L. (Guest)
on 2009-06-02 16:15
(Received via mailing list)
On Jun 1, 6:19 pm, Aaron P. <removed_email_address@domain.invalid> wrote:
> > Only different is I used gcc 4.3.3 from this page:
> >http://sourceforge.net/projects/tdm-gcc/
>
> I think I've got it working now.  The issue is that I was cross
> compiling and testing against 1.9.1-p0.  I've updated to 1.9.1-p129 and
> things seem to be working now:
>
>  http://skitch.com/aaron.patterson/b1qq6/microsoft-windows-xp
>

Chiming in.

In theory and based on Ruby-core comments, 1.9.1-p0 should not differ
at the binary level from p129. So if the cross compilation is failing,
something smell funny over there and I need to review once again rake-
compiler.

Will be weird to require a new release of binaries every time a new
patchlevel of RUby gets out.

Life isn't easy...
Marcin R. (Guest)
on 2009-06-09 12:05
(Received via mailing list)
Old discusion. But my 2$ ;)

If you deploy to for example boxed environment, or host that does have
ruby but don't have rubygems, or project requires that all dependencies
(gems in this case) be unpacked and stored in svn/git. You might find
that his little `require 'rubygems'` suddenly breaks application
deployed into production.

It's a host responsibility to provide library, whatever way it sees fit
- rubygems is just one option.
Florian G. (Guest)
on 2009-06-09 17:15
(Received via mailing list)
On Jun 9, 2009, at 10:05 AM, Marcin R. wrote:

>
I would consider this an edge-case, especially because it is easily
fixed by supplying an empty file named "rubygems.rb" somewhere inside
the load-path, essentially turning `require 'rubygems'` into a noop.

The real "problem" in this is the fact that rubygems also provides the
only common way of expressing a dependency via the `gem` method, which
would then break. So, either we had a generic, gem-independent way of
expressing "i want to require library X in version Y" (which we don't
have) or the library maintainer would not be allowed to use gem -
possibly breaking the library silently in a multitude of setups. I
think it is a library responsibility to express the environment in
which it is able to run.

I guess this status quo is okay.

Regards,
Florian G.

--
Florian G.

smtp:   removed_email_address@domain.invalid
jabber: removed_email_address@domain.invalid
gpg:    533148E2
This topic is locked and can not be replied to.