File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / libxml2 / python / tests / reader8.py
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Sun Jun 15 19:53:34 2014 UTC (10 years, 3 months ago) by misho
Branches: libxml2, MAIN
CVS tags: v2_9_1p0, v2_9_1, HEAD
libxml2 2.9.1

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

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