[libxml-devel] [ libxml-Bugs-21607 ] XML::Reader#read_state never returns MODE_EOF

noreply at rubyforge.org noreply at rubyforge.org
Sat Nov 15 20:00:43 EST 2008


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

Category: General
Group: None
>Status: Closed
>Resolution: Accepted
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: Charlie Savage (cfis)
Date: 2008-11-15 18:00

Message:
Hi K Liu,

This works fine on Windows and Linux, so I'm going to assume its a bug on OS X Leopard and will close.

Thanks for the report.

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

Comment By: K Liu (kliuless)
Date: 2008-08-28 08: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 02: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


More information about the libxml-devel mailing list