3
# this tests the entities substitutions with the XmlTextReader interface
9
# Memory debug specific
10
libxml2.debugMemory(1)
13
def processNode(reader):
16
result = result + "%d %d %s %d\n" % (reader.Depth(), reader.NodeType(),
17
reader.Name(), reader.IsEmptyElement())
20
# Parse a document testing the readerForxxx API
23
<label>some text</label>
40
reader = libxml2.readerForDoc(docstr, "test1", None, 0)
47
print "Error parsing the document test1"
51
print "Unexpected result for test1"
56
# Reuse the reader for another document testing the ReaderNewxxx API
59
<label>some text</label>
76
reader.NewDoc(docstr, "test2", None, 0)
83
print "Error parsing the document test2"
87
print "Unexpected result for test2"
96
# Memory debug specific
97
libxml2.cleanupParser()
98
if libxml2.debugMemory(1) == 0:
101
print "Memory leak %d bytes" % (libxml2.debugMemory(1))