Bugs item #21607, was opened at 2008-08-19 13:24
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=21607&group_id=494

Category: General
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: K Liu (kliuless)
Assigned to: Nobody (None)
Summary: XML::Reader#read_state never returns MODE_EOF

Initial Comment:
Even after the XML::Reader has reached the end of the stream, the read_state is 
returning MODE_READING instead of MODE_EOF.

This is on Mac OS Leopard with libxml 2.6.16.

I do not see the problem on sparc/solaris with libxml 2.6.31.

Sorry, I don't have time to try different versions on the two boxes.


----------------------------------------------------------------------

>Comment By: K Liu (kliuless)
Date: 2008-08-28 09:51

Message:
Here's a simple test case:
# === begin script ===
require 'rubygems'
require 'xml/libxml'

# constant maps
state_map = Hash[
  * XML::Reader.constants.grep(/^MODE_/).collect{|c|
    [XML::Reader.const_get(c), c] 
  }.flatten
]
type_map = Hash[
  * XML::Reader.constants.grep(/^TYPE_/).collect{|c|
    [XML::Reader.const_get(c), c]
  }.flatten
]

rdr = XML::Reader.string('<xml/>')

puts 'Node name / Node type / Read state'
p [rdr.name, type_map[rdr.node_type], state_map[rdr.read_state]]
2.times {
  rdr.read
  p [rdr.name, type_map[rdr.node_type],
state_map[rdr.read_state]]
}
# === end script ===

Output on the Mac:
Node name / Node type / Read state
[nil, "TYPE_NONE", "MODE_INITIAL"]
["xml", "TYPE_ELEMENT", "MODE_READING"]
[nil, "TYPE_NONE", "MODE_READING"]

Output on the Sparc:
Node name / Node type / Read state
[nil, "TYPE_NONE", "MODE_INITIAL"]
["xml", "TYPE_ELEMENT", "MODE_EOF"]
[nil, "TYPE_NONE", "MODE_EOF"]


----------------------------------------------------------------------

Comment By: Charlie Savage (cfis)
Date: 2008-08-20 03:30

Message:
K Liu, do you have a test case we can look at?

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=21607&group_id=494
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to