Alessandro Bonazzi 8c43d5cf2f Patch level : 12.00
Files correlati     : cg0.exe cg0700a.msk cg0700b.msk cg3.exe cg4.exe

Bug                 :

Commento:
Merge 1.0 libraries
2025-04-06 00:42:21 +02:00

33 lines
810 B
Python

#!/usr/bin/env python
import os
import sys
import libxml2
# Memory debug specific
libxml2.debugMemory(1)
import libxslt
basedir = os.path.dirname(os.path.realpath(__file__))
styledoc = libxml2.parseFile("%s/test.xsl" % basedir)
style = libxslt.parseStylesheetDoc(styledoc)
doc = libxml2.parseFile("%s/test.xml" % basedir)
result = style.applyStylesheet(doc, None)
style.saveResultToFilename("foo", result, 0)
os.remove("foo")
stringval = style.saveResultToString(result)
if (len(stringval) != 68):
print("Error in saveResultToString")
sys.exit(255)
style.freeStylesheet()
doc.freeDoc()
result.freeDoc()
# Memory debug specific
libxslt.cleanup()
if libxml2.debugMemory(1) == 0:
print("OK")
else:
print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
sys.exit(255)