3 # this tests the entities substitutions with the XmlTextReader interface
8 # Memory debug specific
12 def processNode(reader
):
15 result
= result
+ "%d %d %s %d\n" % (reader
.Depth(), reader
.NodeType(),
16 reader
.Name(), reader
.IsEmptyElement())
19 # Parse a document testing the readerForxxx API
22 <label>some text</label>
39 doc
= libxml2
.parseDoc(docstr
)
40 reader
= doc
.readerWalker();
47 print("Error parsing the document test1")
51 print("Unexpected result for test1")
58 # Reuse the reader for another document testing the ReaderNewWalker API
61 <label>some text</label>
78 doc
= libxml2
.parseDoc(docstr
)
87 print("Error parsing the document test2")
91 print("Unexpected result for test2")
98 # Reuse the reader for another document testing the ReaderNewxxx API
101 <label>some text</label>
118 reader
.NewDoc(docstr
, "test3", None, 0)
125 print("Error parsing the document test3")
129 print("Unexpected result for test3")
138 # Memory debug specific
139 libxml2
.cleanupParser()
140 if libxml2
.debugMemory(1) == 0:
143 print("Memory leak %d bytes" % (libxml2
.debugMemory(1)))