summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorMike Hommey <glandium@debian.org>2005-03-27 13:13:58 +0000
committerMike Hommey <glandium@debian.org>2005-03-27 13:13:58 +0000
commit50e5b428562964b1eb2f876370058b34b47c5e90 (patch)
treec66bcae6dbbce07128ee881353ff60090524462c /python
parenta7457388701e6ccba9091ba3ec09505dc903b758 (diff)
downloadlibxml2-50e5b428562964b1eb2f876370058b34b47c5e90.tar.gz
Load /tmp/tmp.XJZ6qc/libxml2-2.6.18 intoupstream/2.6.18
packages/libxml2/branches/upstream/current.
Diffstat (limited to 'python')
-rw-r--r--python/Makefile.in2
-rwxr-xr-xpython/generator.py17
-rw-r--r--python/libxml.c26
-rw-r--r--python/libxml2-py.c228
-rwxr-xr-xpython/setup.py2
-rw-r--r--python/tests/Makefile.am6
-rw-r--r--python/tests/Makefile.in8
-rwxr-xr-xpython/tests/readernext.py81
-rwxr-xr-xpython/tests/tstmem.py36
9 files changed, 286 insertions, 120 deletions
diff --git a/python/Makefile.in b/python/Makefile.in
index e1d33cd..4464fa4 100644
--- a/python/Makefile.in
+++ b/python/Makefile.in
@@ -163,7 +163,6 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
-PATTERN_TEST = @PATTERN_TEST@
PERL = @PERL@
PYTHON = @PYTHON@
PYTHON_INCLUDES = @PYTHON_INCLUDES@
@@ -186,6 +185,7 @@ TEST_CATALOG = @TEST_CATALOG@
TEST_DEBUG = @TEST_DEBUG@
TEST_HTML = @TEST_HTML@
TEST_MODULES = @TEST_MODULES@
+TEST_PATTERN = @TEST_PATTERN@
TEST_PHTML = @TEST_PHTML@
TEST_PUSH = @TEST_PUSH@
TEST_REGEXPS = @TEST_REGEXPS@
diff --git a/python/generator.py b/python/generator.py
index 0b09b9a..8add0a9 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -6,13 +6,16 @@
functions = {}
enums = {} # { enumType: { enumConstant: enumValue } }
+import os
import sys
import string
-if len(sys.argv) > 1:
- srcPref = sys.argv[1] + '/'
+if __name__ == "__main__":
+ # launched as a script
+ srcPref = os.path.dirname(sys.argv[0])
else:
- srcPref = ''
+ # imported
+ srcPref = os.path.dirname(__file__)
#######################################################################
#
@@ -341,6 +344,8 @@ def skip_function(name):
# the next function is defined in libxml.c
if name == "xmlRelaxNGFreeValidCtxt":
return 1
+ if name == "xmlFreeValidCtxt":
+ return 1
#
# Those are skipped because the Const version is used of the bindings
# instead.
@@ -596,14 +601,14 @@ def buildStubs():
global unknown_types
try:
- f = open(srcPref + "libxml2-api.xml")
+ f = open(os.path.join(srcPref,"libxml2-api.xml"))
data = f.read()
(parser, target) = getparser()
parser.feed(data)
parser.close()
except IOError, msg:
try:
- f = open(srcPref + "../doc/libxml2-api.xml")
+ f = open(os.path.join(srcPref,"..","doc","libxml2-api.xml"))
data = f.read()
(parser, target) = getparser()
parser.feed(data)
@@ -617,7 +622,7 @@ def buildStubs():
py_types['pythonObject'] = ('O', "pythonObject", "pythonObject", "pythonObject")
try:
- f = open(srcPref + "libxml2-python-api.xml")
+ f = open(os.path.join(srcPref,"libxml2-python-api.xml"))
data = f.read()
(parser, target) = getparser()
parser.feed(data)
diff --git a/python/libxml.c b/python/libxml.c
index ae1a0f4..b520994 100644
--- a/python/libxml.c
+++ b/python/libxml.c
@@ -1858,6 +1858,31 @@ libxml_xmlSetValidErrors(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
return (py_retval);
}
+
+PyObject *
+libxml_xmlFreeValidCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlValidCtxtPtr cur;
+ xmlValidCtxtPyCtxtPtr pyCtxt;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeValidCtxt", &pyobj_cur))
+ return(NULL);
+ cur = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_cur);
+
+ pyCtxt = (xmlValidCtxtPyCtxtPtr)(cur->userData);
+ if (pyCtxt != NULL)
+ {
+ Py_XDECREF(pyCtxt->error);
+ Py_XDECREF(pyCtxt->warn);
+ Py_XDECREF(pyCtxt->arg);
+ xmlFree(pyCtxt);
+ }
+
+ xmlFreeValidCtxt(cur);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
/************************************************************************
* *
* Per xmlTextReader error handler *
@@ -3618,6 +3643,7 @@ static PyMethodDef libxmlMethods[] = {
{(char *) "doc", libxml_doc, METH_VARARGS, NULL},
{(char *) "xmlNewNode", libxml_xmlNewNode, METH_VARARGS, NULL},
{(char *)"xmlSetValidErrors", libxml_xmlSetValidErrors, METH_VARARGS, NULL},
+ {(char *)"xmlFreeValidCtxt", libxml_xmlFreeValidCtxt, METH_VARARGS, NULL},
#ifdef LIBXML_OUTPUT_ENABLED
{(char *) "serializeNode", libxml_serializeNode, METH_VARARGS, NULL},
{(char *) "saveNodeTo", libxml_saveNodeTo, METH_VARARGS, NULL},
diff --git a/python/libxml2-py.c b/python/libxml2-py.c
index e6602a4..b704cd1 100644
--- a/python/libxml2-py.c
+++ b/python/libxml2-py.c
@@ -2866,6 +2866,25 @@ libxml_xmlUCSIsLimbu(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
}
PyObject *
+libxml_xmlRemoveID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlAttrPtr attr;
+ PyObject *pyobj_attr;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlRemoveID", &pyobj_doc, &pyobj_attr))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ attr = (xmlAttrPtr) PyxmlNode_Get(pyobj_attr);
+
+ c_retval = xmlRemoveID(doc, attr);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
libxml_xmlNewDocPI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
xmlNodePtr c_retval;
@@ -3669,25 +3688,6 @@ libxml_xmlErrorGetMessage(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
return(py_retval);
}
-PyObject *
-libxml_xmlRemoveID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
- PyObject *py_retval;
- int c_retval;
- xmlDocPtr doc;
- PyObject *pyobj_doc;
- xmlAttrPtr attr;
- PyObject *pyobj_attr;
-
- if (!PyArg_ParseTuple(args, (char *)"OO:xmlRemoveID", &pyobj_doc, &pyobj_attr))
- return(NULL);
- doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
- attr = (xmlAttrPtr) PyxmlNode_Get(pyobj_attr);
-
- c_retval = xmlRemoveID(doc, attr);
- py_retval = libxml_intWrap((int) c_retval);
- return(py_retval);
-}
-
#ifdef LIBXML_HTML_ENABLED
#endif /* LIBXML_HTML_ENABLED */
#ifdef LIBXML_XPATH_ENABLED
@@ -3986,6 +3986,20 @@ libxml_xmlRegexpExec(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
#endif /* LIBXML_REGEXP_ENABLED */
PyObject *
+libxml_xmlUCSIsCatPe(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatPe", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatPe(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
libxml_xmlByteConsumed(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
long c_retval;
@@ -6136,20 +6150,6 @@ libxml_xmlXPathIsNodeType(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
}
#endif /* LIBXML_XPATH_ENABLED */
-PyObject *
-libxml_xmlFreeValidCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
- xmlValidCtxtPtr cur;
- PyObject *pyobj_cur;
-
- if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeValidCtxt", &pyobj_cur))
- return(NULL);
- cur = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_cur);
-
- xmlFreeValidCtxt(cur);
- Py_INCREF(Py_None);
- return(Py_None);
-}
-
#ifdef LIBXML_XPATH_ENABLED
PyObject *
libxml_xmlXPathRoot(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
@@ -6294,22 +6294,6 @@ libxml_xmlTextReaderDepth(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
}
PyObject *
-libxml_xmlNanoFTPProxy(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
- char * host;
- int port;
- char * user;
- char * passwd;
- int type;
-
- if (!PyArg_ParseTuple(args, (char *)"zizzi:xmlNanoFTPProxy", &host, &port, &user, &passwd, &type))
- return(NULL);
-
- xmlNanoFTPProxy(host, port, user, passwd, type);
- Py_INCREF(Py_None);
- return(Py_None);
-}
-
-PyObject *
libxml_xmlUCSIsHiragana(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
int c_retval;
@@ -6747,20 +6731,6 @@ libxml_xmlReaderNewDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
}
PyObject *
-libxml_xmlParsePI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
- xmlParserCtxtPtr ctxt;
- PyObject *pyobj_ctxt;
-
- if (!PyArg_ParseTuple(args, (char *)"O:xmlParsePI", &pyobj_ctxt))
- return(NULL);
- ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
-
- xmlParsePI(ctxt);
- Py_INCREF(Py_None);
- return(Py_None);
-}
-
-PyObject *
libxml_xmlTextReaderConstPrefix(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
const xmlChar * c_retval;
@@ -6777,6 +6747,20 @@ libxml_xmlTextReaderConstPrefix(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
}
PyObject *
+libxml_xmlRecoverDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDocPtr c_retval;
+ xmlChar * cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlRecoverDoc", &cur))
+ return(NULL);
+
+ c_retval = xmlRecoverDoc(cur);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
libxml_xmlNormalizeWindowsPath(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
xmlChar * c_retval;
@@ -6891,6 +6875,22 @@ libxml_xmlReaderForMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
}
PyObject *
+libxml_xmlTextReaderByteConsumed(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ long c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderByteConsumed", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderByteConsumed(reader);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
libxml_xmlNewDtd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
xmlDtdPtr c_retval;
@@ -7498,6 +7498,22 @@ libxml_xmlParseExtParsedEnt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
}
PyObject *
+libxml_xmlNanoFTPProxy(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ char * host;
+ int port;
+ char * user;
+ char * passwd;
+ int type;
+
+ if (!PyArg_ParseTuple(args, (char *)"zizzi:xmlNanoFTPProxy", &host, &port, &user, &passwd, &type))
+ return(NULL);
+
+ xmlNanoFTPProxy(host, port, user, passwd, type);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
libxml_xmlStringLenDecodeEntities(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
xmlChar * c_retval;
@@ -9675,6 +9691,24 @@ libxml_xmlXPathNotEqualValues(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
#endif /* LIBXML_XPATH_ENABLED */
PyObject *
+libxml_xmlTextReaderMoveToAttributeNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+ xmlChar * localName;
+ xmlChar * namespaceURI;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlTextReaderMoveToAttributeNs", &pyobj_reader, &localName, &namespaceURI))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderMoveToAttributeNs(reader, localName, namespaceURI);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
libxml_xmlUCSIsOgham(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
int c_retval;
@@ -9805,20 +9839,6 @@ libxml_xmlUCSIsCatPf(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
}
PyObject *
-libxml_xmlUCSIsCatPe(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
- PyObject *py_retval;
- int c_retval;
- int code;
-
- if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatPe", &code))
- return(NULL);
-
- c_retval = xmlUCSIsCatPe(code);
- py_retval = libxml_intWrap((int) c_retval);
- return(py_retval);
-}
-
-PyObject *
libxml_xmlUCSIsCatPd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
int c_retval;
@@ -10342,6 +10362,20 @@ libxml_xmlTextConcat(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
}
PyObject *
+libxml_xmlParsePI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParsePI", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlParsePI(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
libxml_xmlLoadCatalogs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
char * pathss;
@@ -10794,24 +10828,6 @@ libxml_xmlParserHandlePEReference(PyObject *self ATTRIBUTE_UNUSED, PyObject *arg
return(Py_None);
}
-PyObject *
-libxml_xmlTextReaderMoveToAttributeNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
- PyObject *py_retval;
- int c_retval;
- xmlTextReaderPtr reader;
- PyObject *pyobj_reader;
- xmlChar * localName;
- xmlChar * namespaceURI;
-
- if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlTextReaderMoveToAttributeNs", &pyobj_reader, &localName, &namespaceURI))
- return(NULL);
- reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
-
- c_retval = xmlTextReaderMoveToAttributeNs(reader, localName, namespaceURI);
- py_retval = libxml_intWrap((int) c_retval);
- return(py_retval);
-}
-
#ifdef LIBXML_XPATH_ENABLED
PyObject *
libxml_xmlXPathNewBoolean(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
@@ -12890,6 +12906,14 @@ libxml_xmlURIGetOpaque(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
}
PyObject *
+libxml_xmlDictCleanup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlDictCleanup();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
libxml_xmlTextReaderReadInnerXml(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
xmlChar * c_retval;
@@ -13133,20 +13157,6 @@ libxml_xmlUCSIsAegeanNumbers(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
}
PyObject *
-libxml_xmlRecoverDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
- PyObject *py_retval;
- xmlDocPtr c_retval;
- xmlChar * cur;
-
- if (!PyArg_ParseTuple(args, (char *)"z:xmlRecoverDoc", &cur))
- return(NULL);
-
- c_retval = xmlRecoverDoc(cur);
- py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
- return(py_retval);
-}
-
-PyObject *
libxml_xmlCheckUTF8(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
int c_retval;
diff --git a/python/setup.py b/python/setup.py
index dd8aa76..748c1a8 100755
--- a/python/setup.py
+++ b/python/setup.py
@@ -226,7 +226,7 @@ else:
setup (name = "libxml2-python",
# On *nix, the version number is created from setup.py.in
# On windows, it is set by configure.js
- version = "2.6.17",
+ version = "2.6.18",
description = descr,
author = "Daniel Veillard",
author_email = "veillard@redhat.com",
diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am
index 1ae9b6c..f41cd6d 100644
--- a/python/tests/Makefile.am
+++ b/python/tests/Makefile.am
@@ -28,6 +28,7 @@ PYTESTS= \
reader6.py \
reader7.py \
reader8.py \
+ readernext.py \
walker.py \
ctxterror.py\
readererr.py\
@@ -37,7 +38,8 @@ PYTESTS= \
sync.py \
tstLastError.py \
indexes.py \
- dtdvalid.py
+ dtdvalid.py \
+ tstmem.py
XMLS= \
tst.xml \
@@ -52,6 +54,8 @@ tests: $(PYTESTS)
@echo "## running Python regression tests"
-@(PYTHONPATH="..:../.libs:$(srcdir)/..:$$PYTHONPATH" ; \
export PYTHONPATH; \
+ LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ; \
+ export LD_LIBRARY_PATH; \
for test in $(PYTESTS) ; \
do log=`$(PYTHON) $(srcdir)/$$test` ; \
if [ "`echo $$log | grep OK`" = "" ] ; then \
diff --git a/python/tests/Makefile.in b/python/tests/Makefile.in
index d13d845..2184681 100644
--- a/python/tests/Makefile.in
+++ b/python/tests/Makefile.in
@@ -123,7 +123,6 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
-PATTERN_TEST = @PATTERN_TEST@
PERL = @PERL@
PYTHON = @PYTHON@
PYTHON_INCLUDES = @PYTHON_INCLUDES@
@@ -146,6 +145,7 @@ TEST_CATALOG = @TEST_CATALOG@
TEST_DEBUG = @TEST_DEBUG@
TEST_HTML = @TEST_HTML@
TEST_MODULES = @TEST_MODULES@
+TEST_PATTERN = @TEST_PATTERN@
TEST_PHTML = @TEST_PHTML@
TEST_PUSH = @TEST_PUSH@
TEST_REGEXPS = @TEST_REGEXPS@
@@ -284,6 +284,7 @@ PYTESTS = \
reader6.py \
reader7.py \
reader8.py \
+ readernext.py \
walker.py \
ctxterror.py\
readererr.py\
@@ -293,7 +294,8 @@ PYTESTS = \
sync.py \
tstLastError.py \
indexes.py \
- dtdvalid.py
+ dtdvalid.py \
+ tstmem.py
XMLS = \
tst.xml \
@@ -465,6 +467,8 @@ uninstall-am: uninstall-info-am
@WITH_PYTHON_TRUE@ @echo "## running Python regression tests"
@WITH_PYTHON_TRUE@ -@(PYTHONPATH="..:../.libs:$(srcdir)/..:$$PYTHONPATH" ; \
@WITH_PYTHON_TRUE@ export PYTHONPATH; \
+@WITH_PYTHON_TRUE@ LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ; \
+@WITH_PYTHON_TRUE@ export LD_LIBRARY_PATH; \
@WITH_PYTHON_TRUE@ for test in $(PYTESTS) ; \
@WITH_PYTHON_TRUE@ do log=`$(PYTHON) $(srcdir)/$$test` ; \
@WITH_PYTHON_TRUE@ if [ "`echo $$log | grep OK`" = "" ] ; then \
diff --git a/python/tests/readernext.py b/python/tests/readernext.py
new file mode 100755
index 0000000..b01a49d
--- /dev/null
+++ b/python/tests/readernext.py
@@ -0,0 +1,81 @@
+#!/usr/bin/python -u
+# -*- coding: ISO-8859-1 -*-
+#
+# this tests the next API of the XmlTextReader interface
+#
+import libxml2
+import StringIO
+import sys
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+f = StringIO.StringIO("""<a><b><c /></b><d>content of d</d></a>""")
+input = libxml2.inputBuffer(f)
+reader = input.newTextReader("test_next")
+ret = reader.Read()
+if ret != 1:
+ print "test_next: Error reading to first element"
+ sys.exit(1)
+if reader.Name() != "a" or reader.IsEmptyElement() != 0 or \
+ reader.NodeType() != 1 or reader.HasAttributes() != 0:
+ print "test_next: Error reading the first element"
+ sys.exit(1)
+ret = reader.Read()
+if ret != 1:
+ print "test_next: Error reading to second element"
+ sys.exit(1)
+if reader.Name() != "b" or reader.IsEmptyElement() != 0 or \
+ reader.NodeType() != 1 or reader.HasAttributes() != 0:
+ print "test_next: Error reading the second element"
+ sys.exit(1)
+ret = reader.Read()
+if ret != 1:
+ print "test_next: Error reading to third element"
+ sys.exit(1)
+if reader.Name() != "c" or reader.NodeType() != 1 or \
+ reader.HasAttributes() != 0:
+ print "test_next: Error reading the third element"
+ sys.exit(1)
+ret = reader.Read()
+if ret != 1:
+ print "test_next: Error reading to end of third element"
+ sys.exit(1)
+if reader.Name() != "b" or reader.NodeType() != 15:
+ print "test_next: Error reading to end of second element"
+ sys.exit(1)
+ret = reader.Next()
+if ret != 1:
+ print "test_next: Error moving to third element"
+ sys.exit(1)
+if reader.Name() != "d" or reader.IsEmptyElement() != 0 or \
+ reader.NodeType() != 1 or reader.HasAttributes() != 0:
+ print "test_next: Error reading third element"
+ sys.exit(1)
+ret = reader.Next()
+if ret != 1:
+ print "test_next: Error reading to end of first element"
+ sys.exit(1)
+if reader.Name() != "a" or reader.IsEmptyElement() != 0 or \
+ reader.NodeType() != 15 or reader.HasAttributes() != 0:
+ print "test_next: Error reading the end of first element"
+ sys.exit(1)
+ret = reader.Read()
+if ret != 0:
+ print "test_next: Error reading to end of document"
+ sys.exit(1)
+
+#
+# cleanup for memory allocation counting
+#
+del f
+del input
+del reader
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/tstmem.py b/python/tests/tstmem.py
new file mode 100755
index 0000000..553096d
--- /dev/null
+++ b/python/tests/tstmem.py
@@ -0,0 +1,36 @@
+#!/usr/bin/python -u
+import libxml2
+import libxml2mod
+import sys
+
+def error(msg, data):
+ pass
+
+# 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()
+libxml2mod.xmlSetValidErrors(ctxt._o, error, error)
+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()