fixed bug #108801 reported by Malcolm Tredinnick about the DocType node
* xmlreader.c: fixed bug #108801 reported by Malcolm Tredinnick
about the DocType node not being reported sometimes.
* python/tests/reader.py: added to test to the regression checks
Daniel
diff --git a/ChangeLog b/ChangeLog
index 4846730..f98f5f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sat Mar 22 13:32:39 CET 2003 Daniel Veillard <daniel@veillard.com>
+
+ * xmlreader.c: fixed bug #108801 reported by Malcolm Tredinnick
+ about the DocType node not being reported sometimes.
+ * python/tests/reader.py: added to test to the regression checks
+
Sat Mar 22 01:57:40 CET 2003 Daniel Veillard <daniel@veillard.com>
* xmlreader.c: fixed bug #108546 on long CDATA (or text nodes)
diff --git a/python/tests/reader.py b/python/tests/reader.py
index e967171..c50adeb 100755
--- a/python/tests/reader.py
+++ b/python/tests/reader.py
@@ -400,6 +400,31 @@
sys.exit(1)
#
+# test from bug #108801
+#
+doc="""<?xml version="1.0" standalone="no"?>
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+ "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
+]>
+
+<article>
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+</article>
+"""
+expect="""10 (article) [None] 0 0
+1 (article) [None] 0 0
+3 (#text) [
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+] 0 1
+15 (article) [None] 0 0
+"""
+res = tst_reader(doc)
+if res != expect:
+ print "test15 failed"
+ print res
+ sys.exit(1)
+
+#
# cleanup for memory allocation counting
#
del f
diff --git a/xmlreader.c b/xmlreader.c
index 9aa1ebe..8621c70 100644
--- a/xmlreader.c
+++ b/xmlreader.c
@@ -598,7 +598,11 @@
return(-1);
reader->state = XML_TEXTREADER_ELEMENT;
} else {
- reader->node = reader->ctxt->nodeTab[0];
+ if (reader->ctxt->myDoc != NULL) {
+ reader->node = reader->ctxt->myDoc->children;
+ }
+ if (reader->node == NULL)
+ reader->node = reader->ctxt->nodeTab[0];
reader->state = XML_TEXTREADER_ELEMENT;
}
reader->depth = 0;