#
# this tests the entities substitutions with the XmlTextReader interface
#
import sys
import StringIO
import libxml2
# Memory debug specific
global result
#
# Parse a document testing the readerForxxx API
#
docstr="""<foo>
<label>some text</label>
<item>100</item>
</foo>"""
expect="""0 1 foo 0
1 14 #text 0
1 1 label 0
2 3 #text 0
1 15 label 0
1 14 #text 0
1 1 item 0
2 3 #text 0
1 15 item 0
1 14 #text 0
0 15 foo 0
"""
while ret == 1:
if ret != 0:
print "Error parsing the document test1"
print "Unexpected result for test1"
print result
#
# Reuse the reader for another document testing the ReaderNewWalker API
#
docstr="""<foo>
<label>some text</label>
<item>1000</item>
</foo>"""
expect="""0 1 foo 0
1 14 #text 0
1 1 label 0
2 3 #text 0
1 15 label 0
1 14 #text 0
1 1 item 0
2 3 #text 0
1 15 item 0
1 14 #text 0
0 15 foo 0
"""
while ret == 1:
if ret != 0:
print "Error parsing the document test2"
print "Unexpected result for test2"
print result
#
# Reuse the reader for another document testing the ReaderNewxxx API
#
docstr="""<foo>
<label>some text</label>
<item>1000</item>
</foo>"""
expect="""0 1 foo 0
1 14 #text 0
1 1 label 0
2 3 #text 0
1 15 label 0
1 14 #text 0
1 1 item 0
2 3 #text 0
1 15 item 0
1 14 #text 0
0 15 foo 0
"""
while ret == 1:
if ret != 0:
print "Error parsing the document test3"
print "Unexpected result for test3"
print result
#
# cleanup
#
del reader
# Memory debug specific
print "OK"
else: