9 # Memory debug specific
10 libxml2
.debugMemory(1)
12 dtd
="""<!ELEMENT foo EMPTY>"""
13 instance
="""<?xml version="1.0"?>
16 dtd
= libxml2
.parseDTD(None, 'test.dtd')
17 ctxt
= libxml2
.newValidCtxt()
18 libxml2mod
.xmlSetValidErrors(ctxt
._o
, error
, error
)
19 doc
= libxml2
.parseDoc(instance
)
20 ret
= doc
.validateDtd(ctxt
, dtd
)
22 print("error doing DTD validation")
30 # Memory debug specific
31 libxml2
.cleanupParser()
32 if libxml2
.debugMemory(1) == 0:
35 print("Memory leak %d bytes" % (libxml2
.debugMemory(1)))