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 reader = libxml2.readerForDoc(docstr, "test1", None, 0)
46 print("Error parsing the document test1")
50 print("Unexpected result for test1")
55 # Reuse the reader for another document testing the ReaderNewxxx API
58 <label>some text</label>
75 reader.NewDoc(docstr, "test2", None, 0)
82 print("Error parsing the document test2")
86 print("Unexpected result for test2")
95 # Memory debug specific
96 libxml2.cleanupParser()
97 if libxml2.debugMemory(1) == 0:
100 print("Memory leak %d bytes" % (libxml2.debugMemory(1)))