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
doc = libxml2.parseDoc(docstr)
41
reader = doc.readerWalker();
48
print "Error parsing the document test1"
52
print "Unexpected result for test1"
59
# Reuse the reader for another document testing the ReaderNewWalker API
62
<label>some text</label>
79
doc = libxml2.parseDoc(docstr)
88
print "Error parsing the document test2"
92
print "Unexpected result for test2"
99
# Reuse the reader for another document testing the ReaderNewxxx API
102
<label>some text</label>
119
reader.NewDoc(docstr, "test3", None, 0)
126
print "Error parsing the document test3"
130
print "Unexpected result for test3"
139
# Memory debug specific
140
libxml2.cleanupParser()
141
if libxml2.debugMemory(1) == 0:
144
print "Memory leak %d bytes" % (libxml2.debugMemory(1))