# Simple problem using Nokogiri xml eaderr

**URL:** <https://www.ruby-forum.com/t/simple-problem-using-nokogiri-xml-eaderr/178846>\
**Category:** Ruby\
**Created:** [November 12, 2009, 7:01am UTC](https://www.ruby-forum.com/t/simple-problem-using-nokogiri-xml-eaderr/178846 "2009-11-12T07:01:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pnomolos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/85f322/32.png) [@pnomolos](https://www.ruby-forum.com/u/pnomolos)\
**Post date:** [November 12, 2009, 7:01am UTC](https://www.ruby-forum.com/t/simple-problem-using-nokogiri-xml-eaderr/178846/1 "2009-11-12T07:01:32Z")

</div>

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:in`each’  
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.

---

<div class="post-metadata">

**Author:** ![pnomolos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/85f322/32.png) [@pnomolos](https://www.ruby-forum.com/u/pnomolos)\
**Post date:** [November 12, 2009, 11:30am UTC](https://www.ruby-forum.com/t/simple-problem-using-nokogiri-xml-eaderr/178846/2 "2009-11-12T11:30:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pnomolos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/85f322/32.png) [@pnomolos](https://www.ruby-forum.com/u/pnomolos)\
**Post date:** [November 12, 2009, 5:35pm UTC](https://www.ruby-forum.com/t/simple-problem-using-nokogiri-xml-eaderr/178846/3 "2009-11-12T17:35:03Z")

</div>

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.
