Simple problem using Nokogiri xml eaderr

P

Philip Stephens

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'?>
<inventory>
<tire name="super slick racing tire" />
<tire name="all weather tire" />
</inventory>
-----------------------------------------------------------------
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:in `each'
from TestNok.rb:7:in `<main>'
<dummy toplevel>: [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
 
R

Ryan Davis

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).=
 
A

Aaron Patterson

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'?>
<inventory>
<tire name="super slick racing tire" />
<tire name="all weather tire" />
</inventory>
-----------------------------------------------------------------
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:in `each'
from TestNok.rb:7:in `<main>'
<dummy toplevel>: [BUG] Segmentation fault
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Problems with GC.. again 5
Strange bug in irb1.9 7

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top