summaryrefslogtreecommitdiff
path: root/python/tests/dtdvalid.py
diff options
context:
space:
mode:
authorMike Hommey <mh@glandium.org>2004-11-11 12:53:54 +0000
committerMike Hommey <mh@glandium.org>2004-11-11 12:53:54 +0000
commitf51dd67f3a3f472af0620391eb588eeca4533689 (patch)
tree9184c396c489196608427d5fa35814e86a1e479f /python/tests/dtdvalid.py
parent9705f1a5e858108d21a0128556f42b25d16833cd (diff)
downloadlibxml2-upstream/2.6.16.tar.gz
Load /tmp/tmp.n9GTkp/libxml2-2.6.16 intoupstream/2.6.16
packages/libxml2/branches/upstream/current.
Diffstat (limited to 'python/tests/dtdvalid.py')
-rwxr-xr-xpython/tests/dtdvalid.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/python/tests/dtdvalid.py b/python/tests/dtdvalid.py
new file mode 100755
index 0000000..2011f2c
--- /dev/null
+++ b/python/tests/dtdvalid.py
@@ -0,0 +1,32 @@
+#!/usr/bin/python -u
+import libxml2
+import sys
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+dtd="""<!ELEMENT foo EMPTY>"""
+instance="""<?xml version="1.0"?>
+<foo></foo>"""
+
+dtd = libxml2.parseDTD(None, 'test.dtd')
+ctxt = libxml2.newValidCtxt()
+doc = libxml2.parseDoc(instance)
+ret = doc.validateDtd(ctxt, dtd)
+if ret != 1:
+ print "error doing DTD validation"
+ sys.exit(1)
+
+doc.freeDoc()
+dtd.freeDtd()
+del dtd
+del ctxt
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
+