Simple problem using Nokogiri xml eaderr

Hi. I am a newbie when it comes to using Nokogiri reader to parse an
xml file. Here is the xml file I want to parse and sample code:

<?xml version='1.0' encoding='UTF-8'?>



require ‘rubygems’
require ‘nokogiri’

io = File.open(‘test.xml’, ‘r’)
reader = Nokogiri::XML::Reader(io)

reader.each do |node|

node is an instance of Nokogiri::XML::Readerruby

puts node.name

end

The following is the error message I get:

pcs$ ruby1.9 TestNok.rb
WARNING: Nokogiri was built against LibXML version 2.6.32, but has
dynamically loaded 2.7.5
/usr/lib/ruby/1.9.0/nokogiri/xml/reader.rb:60:in read': ParsePI: PI xm never end ... (Nokogiri::XML::SyntaxError) from /usr/lib/ruby/1.9.0/nokogiri/xml/reader.rb:60:ineach’
from TestNok.rb:7:in `’
: [BUG] Segmentation fault
ruby 1.9.0 (2008-10-04 revision 19669) [i486-linux]

– control frame ----------
c:0001 p:0000 s:0002 b:0002 l:000001 d:000001 TOP

– backtrace of native function call (Use addr2line) –
0xb08316
0xa285e7
0xa2866a
0xab1144
0x9a0410
0xa5f315
0xa2b994
0xa2baae
0x80487e8
0x469b56
0x80486e1

Aborted

Any help would be greatly appreciated.

On Nov 11, 2009, at 22:01 , Philip S. wrote:

pcs$ ruby1.9 TestNok.rb
WARNING: Nokogiri was built against LibXML version 2.6.32, but has
dynamically loaded 2.7.5

I suggest you look into this. your code works fine for me (tho I’m
running on 1.8.7 as well).

On Thu, Nov 12, 2009 at 03:01:35PM +0900, Philip S. wrote:

require ‘nokogiri’

ruby 1.9.0 (2008-10-04 revision 19669) [i486-linux]
^^^^^ Looks like you’re using 1.9.0

There are bugs in 1.9.0 which cause nokogiri to crash. I suggest you
upgrade to the latest 1.9.1 release and reinstall nokogiri.