Annotation of embedaddon/libxml2/python/tests/reader8.py, revision 1.1.1.1

1.1       misho       1: #!/usr/bin/python -u
                      2: #
                      3: # this tests the entities substitutions with the XmlTextReader interface
                      4: #
                      5: import sys
                      6: import StringIO
                      7: import libxml2
                      8: 
                      9: # Memory debug specific
                     10: libxml2.debugMemory(1)
                     11: 
                     12: #
                     13: # Parse a document testing the Close() API
                     14: #
                     15: docstr="""<foo>
                     16: <label>some text</label>
                     17: <item>100</item>
                     18: </foo>"""
                     19: 
                     20: reader = libxml2.readerForDoc(docstr, "test1", None, 0)
                     21: ret = reader.Read()
                     22: ret = reader.Read()
                     23: ret = reader.Close()
                     24: 
                     25: if ret != 0:
                     26:     print "Error closing the document test1"
                     27:     sys.exit(1)
                     28: 
                     29: del reader
                     30: 
                     31: # Memory debug specific
                     32: libxml2.cleanupParser()
                     33: if libxml2.debugMemory(1) == 0:
                     34:     print "OK"
                     35: else:
                     36:     print "Memory leak %d bytes" % (libxml2.debugMemory(1))
                     37:     libxml2.dumpMemory()

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>