1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-13 09:01:53 +03:00

okay the DTD validation code on top of the XMLTextParser API should be

* xmlreader.c python/tests/reader2py: okay the DTD validation
  code on top of the XMLTextParser API should be solid now.
Daniel
This commit is contained in:
Daniel Veillard
2003-01-03 12:52:08 +00:00
parent 1fdfd115e5
commit a80ff6ec18
3 changed files with 129 additions and 10 deletions

View File

@ -197,6 +197,45 @@ if err != "":
print err
sys.exit(1)
#
# The same test but without entity substitution this time
#
s = """<!DOCTYPE test [
<!ELEMENT test (x, x)>
<!ELEMENT x (y)>
<!ELEMENT y (#PCDATA)>
<!ENTITY x "<x>&y;</x>">
<!ENTITY y "<y>yyy</y>">
]>
<test>
&x;
&x;
</test>"""
expect="""1 test 0
3 #text 1
5 x 1
3 #text 1
5 x 1
3 #text 1
15 test 0
"""
res=""
err=""
input = libxml2.inputBuffer(StringIO.StringIO(s))
reader = input.newTextReader("test4")
reader.SetParserProp(libxml2.PARSER_VALIDATE,1)
while reader.Read() == 1:
res = res + "%s %s %d\n" % (reader.NodeType(),reader.Name(),reader.Depth())
if res != expect:
print "test5 failed: unexpected output"
print res
if err != "":
print "test5 failed: validation error found"
print err
#
# cleanup
#