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