fixed a limit case problem with "<a/>" Daniel

* xmlreader.c python/tests/reader.py: fixed a limit case problem
  with "<a/>"
Daniel
This commit is contained in:
Daniel Veillard 2002-12-30 11:42:17 +00:00
parent ecaba49a72
commit aaa105b590
3 changed files with 30 additions and 1 deletions

View File

@ -1,3 +1,8 @@
Mon Dec 30 12:39:55 CET 2002 Daniel Veillard <daniel@veillard.com>
* xmlreader.c python/tests/reader.py: fixed a limit case problem
with "<a/>"
Mon Dec 30 11:53:44 CET 2002 Daniel Veillard <daniel@veillard.com>
* SAX.c: warn on xmlns:prefix="foo"

View File

@ -301,6 +301,28 @@ if reader.NamespaceUri() != "http://www.w3.org/2000/xmlns/" or \
print "test7: failed to read the namespace node"
sys.exit(1)
#
# Test for a limit case:
#
f = StringIO.StringIO("""<a/>""")
input = libxml2.inputBuffer(f)
reader = input.newTextReader("test8")
ret = reader.Read()
if ret != 1:
print "test8: failed to read the node"
sys.exit(1)
if reader.Name() != "a" or reader.IsEmptyElement() != 1:
print "test8: failed to analyze the node"
sys.exit(1)
ret = reader.Read()
if ret != 0:
print "test8: failed to detect the EOF"
sys.exit(1)
#
# cleanup for memory allocation counting
#
del f
del input
del reader

View File

@ -264,7 +264,9 @@ xmlTextReaderPushData(xmlTextReaderPtr reader) {
if (val <= 0) {
reader->mode = XML_TEXTREADER_MODE_EOF;
reader->state = oldstate;
return(val);
if ((oldstate != XML_TEXTREADER_START) ||
(reader->ctxt->myDoc != NULL))
return(val);
}
} else
break;