3 # this tests the basic APIs of the XmlTextReader interface
9 str_io = StringIO.StringIO
14 # Memory debug specific
15 libxml2.debugMemory(1)
19 input = libxml2.inputBuffer(f)
20 reader = input.newTextReader("tst")
23 res=res + "%s (%s) [%s] %d\n" % (reader.NodeType(),reader.Name(),
24 reader.Value(), reader.IsEmptyElement())
25 if reader.NodeType() == 1: # Element
26 while reader.MoveToNextAttribute():
27 res = res + "-- %s (%s) [%s]\n" % (reader.NodeType(),
28 reader.Name(),reader.Value())
31 expect="""1 (test) [None] 0
37 res = tst_reader("""<test><b/><c/></test>""")
40 print("Did not get the expected error message:")
44 # Memory debug specific
45 libxml2.cleanupParser()
46 if libxml2.debugMemory(1) == 0:
49 print("Memory leak %d bytes" % (libxml2.debugMemory(1)))