File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / libxml2 / python / tests / push.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, 5 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: import sys
    3: import libxml2
    4: 
    5: # Memory debug specific
    6: libxml2.debugMemory(1)
    7: 
    8: ctxt = libxml2.createPushParser(None, "<foo", 4, "test.xml")
    9: ctxt.parseChunk("/>", 2, 1)
   10: doc = ctxt.doc()
   11: ctxt=None
   12: if doc.name != "test.xml":
   13:     print("document name error")
   14:     sys.exit(1)
   15: root = doc.children
   16: if root.name != "foo":
   17:     print("root element name error")
   18:     sys.exit(1)
   19: doc.freeDoc()
   20: i = 10000
   21: while i > 0:
   22:     ctxt = libxml2.createPushParser(None, "<foo", 4, "test.xml")
   23:     ctxt.parseChunk("/>", 2, 1)
   24:     doc = ctxt.doc()
   25:     doc.freeDoc()
   26:     i = i -1
   27: ctxt=None
   28: 
   29: # Memory debug specific
   30: libxml2.cleanupParser()
   31: if libxml2.debugMemory(1) == 0:
   32:     print("OK")
   33: else:
   34:     print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
   35:     libxml2.dumpMemory()

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