summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/Makefile.am6
-rw-r--r--python/Makefile.in10
-rw-r--r--python/drv_libxml2.py1
-rwxr-xr-xpython/generator.py17
-rw-r--r--python/libxml.c183
-rw-r--r--python/libxml.py32
-rw-r--r--python/libxml2-py.c295
-rw-r--r--python/libxml_wrap.h31
-rwxr-xr-xpython/setup.py2
-rw-r--r--python/tests/Makefile.am3
-rw-r--r--python/tests/Makefile.in7
-rwxr-xr-xpython/tests/schema.py52
-rw-r--r--python/types.c57
13 files changed, 609 insertions, 87 deletions
diff --git a/python/Makefile.am b/python/Makefile.am
index f473421..27feef0 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -23,7 +23,7 @@ EXTRA_DIST = \
libxml2-python-api.xml \
$(DOCS)
-libxml2mod_la_LDFLAGS = -module -avoid-version -L$(top_builddir)/.libs
+libxml2mod_la_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@ @WIN32_EXTRA_LDFLAGS@ -module -avoid-version -L$(top_builddir)/.libs
if WITH_PYTHON
mylibs = \
@@ -34,7 +34,7 @@ all-local: libxml2.py
python_LTLIBRARIES = libxml2mod.la
libxml2mod_la_SOURCES = libxml.c types.c libxml2-py.c
-libxml2mod_la_LIBADD = $(mylibs)
+libxml2mod_la_LIBADD = $(mylibs) @CYGWIN_EXTRA_PYTHON_LIBADD@
libxml2.py: $(srcdir)/libxml.py $(srcdir)/libxml2class.py
cat $(srcdir)/libxml.py $(srcdir)/libxml2class.py > libxml2.py
@@ -69,5 +69,5 @@ else
all:
endif
tests test: all
- cd tests && $(MAKE) tests
+ cd tests && $(MAKE) MAKEFLAGS+=--silent tests
diff --git a/python/Makefile.in b/python/Makefile.in
index 25d2039..f1fed8a 100644
--- a/python/Makefile.in
+++ b/python/Makefile.in
@@ -104,6 +104,8 @@ CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
+CYGWIN_EXTRA_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@
+CYGWIN_EXTRA_PYTHON_LIBADD = @CYGWIN_EXTRA_PYTHON_LIBADD@
DEBUG_OBJ = @DEBUG_OBJ@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
@@ -136,6 +138,7 @@ LIBXML_MAJOR_VERSION = @LIBXML_MAJOR_VERSION@
LIBXML_MICRO_VERSION = @LIBXML_MICRO_VERSION@
LIBXML_MINOR_VERSION = @LIBXML_MINOR_VERSION@
LIBXML_VERSION = @LIBXML_VERSION@
+LIBXML_VERSION_EXTRA = @LIBXML_VERSION_EXTRA@
LIBXML_VERSION_INFO = @LIBXML_VERSION_INFO@
LIBXML_VERSION_NUMBER = @LIBXML_VERSION_NUMBER@
LN_S = @LN_S@
@@ -153,6 +156,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PATTERN_TEST = @PATTERN_TEST@
+PERL = @PERL@
PYTHON = @PYTHON@
PYTHON_INCLUDES = @PYTHON_INCLUDES@
PYTHON_SITE_PACKAGES = @PYTHON_SITE_PACKAGES@
@@ -299,13 +303,13 @@ EXTRA_DIST = \
libxml2-python-api.xml \
$(DOCS)
-libxml2mod_la_LDFLAGS = -module -avoid-version -L$(top_builddir)/.libs
+libxml2mod_la_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@ @WIN32_EXTRA_LDFLAGS@ -module -avoid-version -L$(top_builddir)/.libs
@WITH_PYTHON_TRUE@mylibs = \
@WITH_PYTHON_TRUE@ $(top_builddir)/libxml2.la
@WITH_PYTHON_TRUE@python_LTLIBRARIES = libxml2mod.la
@WITH_PYTHON_TRUE@libxml2mod_la_SOURCES = libxml.c types.c libxml2-py.c
-@WITH_PYTHON_TRUE@libxml2mod_la_LIBADD = $(mylibs)
+@WITH_PYTHON_TRUE@libxml2mod_la_LIBADD = $(mylibs) @CYGWIN_EXTRA_PYTHON_LIBADD@
@WITH_PYTHON_TRUE@GENERATE = generator.py
@WITH_PYTHON_TRUE@API_DESC = $(top_srcdir)/doc/libxml2-api.xml $(srcdir)/libxml2-python-api.xml
@WITH_PYTHON_TRUE@GENERATED = $(srcdir)/libxml2class.py \
@@ -705,7 +709,7 @@ uninstall-info: uninstall-info-recursive
@WITH_PYTHON_FALSE@all:
tests test: all
- cd tests && $(MAKE) tests
+ cd tests && $(MAKE) MAKEFLAGS+=--silent tests
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/python/drv_libxml2.py b/python/drv_libxml2.py
index 977c868..421f945 100644
--- a/python/drv_libxml2.py
+++ b/python/drv_libxml2.py
@@ -1,3 +1,4 @@
+# -*- coding: iso-8859-1 -*-
""" A SAX2 driver for libxml2, on top of it's XmlReader API
USAGE
diff --git a/python/generator.py b/python/generator.py
index 3ae5729..df89c4e 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -282,6 +282,9 @@ py_types = {
'xmlRelaxNGPtr': ('O', "relaxNgSchema", "xmlRelaxNGPtr", "xmlRelaxNGPtr"),
'xmlRelaxNGParserCtxtPtr': ('O', "relaxNgParserCtxt", "xmlRelaxNGParserCtxtPtr", "xmlRelaxNGParserCtxtPtr"),
'xmlRelaxNGValidCtxtPtr': ('O', "relaxNgValidCtxt", "xmlRelaxNGValidCtxtPtr", "xmlRelaxNGValidCtxtPtr"),
+ 'xmlSchemaPtr': ('O', "Schema", "xmlSchemaPtr", "xmlSchemaPtr"),
+ 'xmlSchemaParserCtxtPtr': ('O', "SchemaParserCtxt", "xmlSchemaParserCtxtPtr", "xmlSchemaParserCtxtPtr"),
+ 'xmlSchemaValidCtxtPtr': ('O', "SchemaValidCtxt", "xmlSchemaValidCtxtPtr", "xmlSchemaValidCtxtPtr"),
}
py_return_types = {
@@ -666,6 +669,9 @@ classes_type = {
'xmlRelaxNGPtr': ('._o', "relaxNgSchema(_obj=%s)", "relaxNgSchema"),
'xmlRelaxNGParserCtxtPtr': ('._o', "relaxNgParserCtxt(_obj=%s)", "relaxNgParserCtxt"),
'xmlRelaxNGValidCtxtPtr': ('._o', "relaxNgValidCtxt(_obj=%s)", "relaxNgValidCtxt"),
+ 'xmlSchemaPtr': ("._o", "Schema(_obj=%s)", "Schema"),
+ 'xmlSchemaParserCtxtPtr': ("._o", "SchemaParserCtxt(_obj=%s)", "SchemaParserCtxt"),
+ 'xmlSchemaValidCtxtPtr': ("._o", "SchemaValidCtxt(_obj=%s)", "SchemaValidCtxt"),
}
converter_type = {
@@ -699,6 +705,9 @@ classes_destructors = {
"relaxNgSchema": "xmlRelaxNGFree",
"relaxNgParserCtxt": "xmlRelaxNGFreeParserCtxt",
"relaxNgValidCtxt": "xmlRelaxNGFreeValidCtxt",
+ "Schema": "xmlSchemaFree",
+ "SchemaParserCtxt": "xmlSchemaFreeParserCtxt",
+ "SchemaValidCtxt": "xmlSchemaFreeValidCtxt",
}
functions_noexcept = {
@@ -710,6 +719,7 @@ functions_noexcept = {
reference_keepers = {
"xmlTextReader": [('inputBuffer', 'input')],
"relaxNgValidCtxt": [('relaxNgSchema', 'schema')],
+ "SchemaValidCtxt": [('Schema', 'schema')],
}
function_classes = {}
@@ -1016,6 +1026,13 @@ def buildWrappers():
classes.write("class %s(%s):\n" % (classname,
classes_ancestor[classname]))
classes.write(" def __init__(self, _obj=None):\n")
+ if classes_ancestor[classname] == "xmlCore" or \
+ classes_ancestor[classname] == "xmlNode":
+ classes.write(" if type(_obj).__name__ != ")
+ classes.write("'PyCObject':\n")
+ classes.write(" raise TypeError, ")
+ classes.write("'%s needs a PyCObject argument'\n" % \
+ classname)
if reference_keepers.has_key(classname):
rlist = reference_keepers[classname]
for ref in rlist:
diff --git a/python/libxml.c b/python/libxml.c
index 3db0f5f..9e24314 100644
--- a/python/libxml.c
+++ b/python/libxml.c
@@ -95,7 +95,8 @@ static void
libxml_xmlErrorInitialize(void); /* forward declare */
PyObject *
-libxml_xmlMemoryUsed(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+libxml_xmlMemoryUsed(PyObject * self ATTRIBUTE_UNUSED,
+ PyObject * args ATTRIBUTE_UNUSED)
{
long ret;
PyObject *py_retval;
@@ -107,7 +108,7 @@ libxml_xmlMemoryUsed(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
}
PyObject *
-libxml_xmlDebugMemory(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+libxml_xmlDebugMemory(PyObject * self ATTRIBUTE_UNUSED, PyObject * args)
{
int activate;
PyObject *py_retval;
@@ -2947,6 +2948,173 @@ libxml_xmlRelaxNGFreeValidCtxt(ATTRIBUTE_UNUSED PyObject *self, PyObject *args)
return(Py_None);
}
+typedef struct
+{
+ PyObject *warn;
+ PyObject *error;
+ PyObject *arg;
+} xmlSchemaValidCtxtPyCtxt;
+typedef xmlSchemaValidCtxtPyCtxt *xmlSchemaValidCtxtPyCtxtPtr;
+
+static void
+libxml_xmlSchemaValidityGenericErrorFuncHandler(void *ctx, char *str)
+{
+ PyObject *list;
+ PyObject *result;
+ xmlSchemaValidCtxtPyCtxtPtr pyCtxt;
+
+#ifdef DEBUG_ERROR
+ printf("libxml_xmlSchemaValiditiyGenericErrorFuncHandler(%p, %s, ...) called\n", ctx, str);
+#endif
+
+ pyCtxt = (xmlSchemaValidCtxtPyCtxtPtr) ctx;
+
+ list = PyTuple_New(2);
+ PyTuple_SetItem(list, 0, libxml_charPtrWrap(str));
+ PyTuple_SetItem(list, 1, pyCtxt->arg);
+ Py_XINCREF(pyCtxt->arg);
+ result = PyEval_CallObject(pyCtxt->error, list);
+ if (result == NULL)
+ {
+ /* TODO: manage for the exception to be propagated... */
+ PyErr_Print();
+ }
+ Py_XDECREF(list);
+ Py_XDECREF(result);
+}
+
+static void
+libxml_xmlSchemaValidityGenericWarningFuncHandler(void *ctx, char *str)
+{
+ PyObject *list;
+ PyObject *result;
+ xmlSchemaValidCtxtPyCtxtPtr pyCtxt;
+
+#ifdef DEBUG_ERROR
+ printf("libxml_xmlSchemaValidityGenericWarningFuncHandler(%p, %s, ...) called\n", ctx, str);
+#endif
+
+ pyCtxt = (xmlSchemaValidCtxtPyCtxtPtr) ctx;
+
+ list = PyTuple_New(2);
+ PyTuple_SetItem(list, 0, libxml_charPtrWrap(str));
+ PyTuple_SetItem(list, 1, pyCtxt->arg);
+ Py_XINCREF(pyCtxt->arg);
+ result = PyEval_CallObject(pyCtxt->warn, list);
+ if (result == NULL)
+ {
+ /* TODO: manage for the exception to be propagated... */
+ PyErr_Print();
+ }
+ Py_XDECREF(list);
+ Py_XDECREF(result);
+}
+
+static void
+libxml_xmlSchemaValidityErrorFunc(void *ctx, const char *msg, ...)
+{
+ va_list ap;
+
+ va_start(ap, msg);
+ libxml_xmlSchemaValidityGenericErrorFuncHandler(ctx, libxml_buildMessage(msg, ap));
+ va_end(ap);
+}
+
+static void
+libxml_xmlSchemaValidityWarningFunc(void *ctx, const char *msg, ...)
+{
+ va_list ap;
+
+ va_start(ap, msg);
+ libxml_xmlSchemaValidityGenericWarningFuncHandler(ctx, libxml_buildMessage(msg, ap));
+ va_end(ap);
+}
+
+PyObject *
+libxml_xmlSchemaSetValidErrors(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+{
+ PyObject *py_retval;
+ PyObject *pyobj_error;
+ PyObject *pyobj_warn;
+ PyObject *pyobj_ctx;
+ PyObject *pyobj_arg = Py_None;
+ xmlSchemaValidCtxtPtr ctxt;
+ xmlSchemaValidCtxtPyCtxtPtr pyCtxt;
+
+ if (!PyArg_ParseTuple
+ (args, (char *) "OOO|O:xmlSchemaSetValidErrors", &pyobj_ctx, &pyobj_error, &pyobj_warn, &pyobj_arg))
+ return (NULL);
+
+#ifdef DEBUG_ERROR
+ printf("libxml_xmlSchemaSetValidErrors(%p, %p, %p) called\n", pyobj_ctx, pyobj_error, pyobj_warn);
+#endif
+
+ ctxt = PySchemaValidCtxt_Get(pyobj_ctx);
+ if (xmlSchemaGetValidErrors(ctxt, NULL, NULL, (void **) &pyCtxt) == -1)
+ {
+ py_retval = libxml_intWrap(-1);
+ return(py_retval);
+ }
+
+ if (pyCtxt == NULL)
+ {
+ /* first time to set the error handlers */
+ pyCtxt = xmlMalloc(sizeof(xmlSchemaValidCtxtPyCtxt));
+ if (pyCtxt == NULL) {
+ py_retval = libxml_intWrap(-1);
+ return(py_retval);
+ }
+ memset(pyCtxt, 0, sizeof(xmlSchemaValidCtxtPyCtxt));
+ }
+
+ /* TODO: check warn and error is a function ! */
+ Py_XDECREF(pyCtxt->error);
+ Py_XINCREF(pyobj_error);
+ pyCtxt->error = pyobj_error;
+
+ Py_XDECREF(pyCtxt->warn);
+ Py_XINCREF(pyobj_warn);
+ pyCtxt->warn = pyobj_warn;
+
+ Py_XDECREF(pyCtxt->arg);
+ Py_XINCREF(pyobj_arg);
+ pyCtxt->arg = pyobj_arg;
+
+ xmlSchemaSetValidErrors(ctxt, &libxml_xmlSchemaValidityErrorFunc, &libxml_xmlSchemaValidityWarningFunc, pyCtxt);
+
+ py_retval = libxml_intWrap(1);
+ return(py_retval);
+}
+
+#if 0
+PyObject *
+libxml_xmlSchemaFreeValidCtxt(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+{
+ xmlSchemaValidCtxtPtr ctxt;
+ xmlSchemaValidCtxtPyCtxtPtr pyCtxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlSchemaFreeValidCtxt", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlSchemaValidCtxtPtr) PySchemaValidCtxt_Get(pyobj_ctxt);
+
+ if (xmlSchemaGetValidErrors(ctxt, NULL, NULL, (void **) &pyCtxt) == 0)
+ {
+ if (pyCtxt != NULL)
+ {
+ Py_XDECREF(pyCtxt->error);
+ Py_XDECREF(pyCtxt->warn);
+ Py_XDECREF(pyCtxt->arg);
+ xmlFree(pyCtxt);
+ }
+ }
+
+ xmlSchemaFreeValidCtxt(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+#endif
+
#endif
#ifdef LIBXML_C14N_ENABLED
@@ -3242,7 +3410,17 @@ libxml_C14NDocSaveTo(ATTRIBUTE_UNUSED PyObject * self,
#endif
#endif
+static PyObject *
+libxml_getObjDesc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+
+ PyObject *obj;
+ char *str;
+ if (!PyArg_ParseTuple(args, (char *)"O:getObjDesc", &obj))
+ return NULL;
+ str = PyCObject_GetDesc(obj);
+ return Py_BuildValue((char *)"s", str);
+}
/************************************************************************
* *
@@ -3289,6 +3467,7 @@ static PyMethodDef libxmlMethods[] = {
{(char *)"xmlC14NDocSaveTo", libxml_C14NDocSaveTo, METH_VARARGS, NULL},
#endif
#endif
+ {(char *) "getObjDesc", libxml_getObjDesc, METH_VARARGS, NULL},
{NULL, NULL, 0, NULL}
};
diff --git a/python/libxml.py b/python/libxml.py
index 5980974..1036bd9 100644
--- a/python/libxml.py
+++ b/python/libxml.py
@@ -82,19 +82,19 @@ class ioWriteWrapper(ioWrapper):
def __init__(self, _obj, enc = ""):
# print "ioWriteWrapper.__init__", _obj
if type(_obj) == type(''):
- print "write io from a string"
- self.o = None
- elif type(_obj) == types.InstanceType:
- print "write io from instance of %s" % (_obj.__class__)
- ioWrapper.__init__(self, _obj)
- self._o = libxml2mod.xmlCreateOutputBuffer(self, enc)
- else:
- file = libxml2mod.outputBufferGetPythonFile(_obj)
- if file != None:
- ioWrapper.__init__(self, file)
- else:
- ioWrapper.__init__(self, _obj)
- self._o = _obj
+ print "write io from a string"
+ self.o = None
+ elif type(_obj) == types.InstanceType:
+ print "write io from instance of %s" % (_obj.__class__)
+ ioWrapper.__init__(self, _obj)
+ self._o = libxml2mod.xmlCreateOutputBuffer(self, enc)
+ else:
+ file = libxml2mod.outputBufferGetPythonFile(_obj)
+ if file != None:
+ ioWrapper.__init__(self, file)
+ else:
+ ioWrapper.__init__(self, _obj)
+ self._o = _obj
def __del__(self):
# print "__del__"
@@ -488,19 +488,19 @@ class xmlCoreBreadthFirstItertor:
#
def nodeWrap(o):
# TODO try to cast to the most appropriate node class
- name = libxml2mod.name(o)
+ name = libxml2mod.type(o)
if name == "element" or name == "text":
return xmlNode(_obj=o)
if name == "attribute":
return xmlAttr(_obj=o)
if name[0:8] == "document":
return xmlDoc(_obj=o)
- if name[0:8] == "namespace":
+ if name == "namespace":
return xmlNs(_obj=o)
if name == "elem_decl":
return xmlElement(_obj=o)
if name == "attribute_decl":
- return xmlAtribute(_obj=o)
+ return xmlAttribute(_obj=o)
if name == "entity_decl":
return xmlEntity(_obj=o)
if name == "dtd":
diff --git a/python/libxml2-py.c b/python/libxml2-py.c
index a0a6958..b562abf 100644
--- a/python/libxml2-py.c
+++ b/python/libxml2-py.c
@@ -402,21 +402,6 @@ libxml_xmlRecoverMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
}
PyObject *
-libxml_xmlValidateNCName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
- PyObject *py_retval;
- int c_retval;
- xmlChar * value;
- int space;
-
- if (!PyArg_ParseTuple(args, (char *)"zi:xmlValidateNCName", &value, &space))
- return(NULL);
-
- c_retval = xmlValidateNCName(value, space);
- py_retval = libxml_intWrap((int) c_retval);
- return(py_retval);
-}
-
-PyObject *
libxml_xmlTextReaderIsDefault(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
int c_retval;
@@ -841,6 +826,23 @@ libxml_xmlCopyChar(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
return(py_retval);
}
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlSchemaNewMemParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlSchemaParserCtxtPtr c_retval;
+ char * buffer;
+ int size;
+
+ if (!PyArg_ParseTuple(args, (char *)"zi:xmlSchemaNewMemParserCtxt", &buffer, &size))
+ return(NULL);
+
+ c_retval = xmlSchemaNewMemParserCtxt(buffer, size);
+ py_retval = libxml_xmlSchemaParserCtxtPtrWrap((xmlSchemaParserCtxtPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
PyObject *
libxml_xmlCleanupGlobals(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
@@ -1485,6 +1487,54 @@ libxml_xmlStrcat(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
return(py_retval);
}
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlSchemaFreeParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlSchemaParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlSchemaFreeParserCtxt", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlSchemaParserCtxtPtr) PySchemaParserCtxt_Get(pyobj_ctxt);
+
+ xmlSchemaFreeParserCtxt(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlSchemaFreeValidCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlSchemaValidCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlSchemaFreeValidCtxt", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlSchemaValidCtxtPtr) PySchemaValidCtxt_Get(pyobj_ctxt);
+
+ xmlSchemaFreeValidCtxt(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlSchemaNewParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlSchemaParserCtxtPtr c_retval;
+ char * URL;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlSchemaNewParserCtxt", &URL))
+ return(NULL);
+
+ c_retval = xmlSchemaNewParserCtxt(URL);
+ py_retval = libxml_xmlSchemaParserCtxtPtrWrap((xmlSchemaParserCtxtPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
PyObject *
libxml_xmlInitializeCatalog(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
@@ -2212,6 +2262,26 @@ libxml_xmlDefaultSAXHandlerInit(PyObject *self ATTRIBUTE_UNUSED, PyObject *args
}
PyObject *
+libxml_xmlReaderNewFd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+ int fd;
+ char * URL;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oizzi:xmlReaderNewFd", &pyobj_reader, &fd, &URL, &encoding, &options))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlReaderNewFd(reader, fd, URL, encoding, options);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
libxml_xmlUCSIsBraillePatterns(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
int c_retval;
@@ -2546,6 +2616,27 @@ libxml_xmlXPathLangFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
}
#endif /* LIBXML_XPATH_ENABLED */
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlSchemaValidateDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlSchemaValidCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlDocPtr instance;
+ PyObject *pyobj_instance;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlSchemaValidateDoc", &pyobj_ctxt, &pyobj_instance))
+ return(NULL);
+ ctxt = (xmlSchemaValidCtxtPtr) PySchemaValidCtxt_Get(pyobj_ctxt);
+ instance = (xmlDocPtr) PyxmlNode_Get(pyobj_instance);
+
+ c_retval = xmlSchemaValidateDoc(ctxt, instance);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
#ifdef LIBXML_XPATH_ENABLED
PyObject *
libxml_xmlXPathEvalExpression(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
@@ -4215,6 +4306,22 @@ libxml_xmlParserInputBufferPush(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
return(py_retval);
}
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlSchemaFree(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlSchemaPtr schema;
+ PyObject *pyobj_schema;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlSchemaFree", &pyobj_schema))
+ return(NULL);
+ schema = (xmlSchemaPtr) PySchema_Get(pyobj_schema);
+
+ xmlSchemaFree(schema);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
PyObject *
libxml_xmlSaveFormatFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
@@ -4778,6 +4885,24 @@ libxml_xmlStrcasestr(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
return(py_retval);
}
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlSchemaParse(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlSchemaPtr c_retval;
+ xmlSchemaParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlSchemaParse", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlSchemaParserCtxtPtr) PySchemaParserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlSchemaParse(ctxt);
+ py_retval = libxml_xmlSchemaPtrWrap((xmlSchemaPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
PyObject *
libxml_xmlTextReaderReadState(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
@@ -5169,6 +5294,21 @@ libxml_xmlUCSIsArrows(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
}
PyObject *
+libxml_xmlValidateNCName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * value;
+ int space;
+
+ if (!PyArg_ParseTuple(args, (char *)"zi:xmlValidateNCName", &value, &space))
+ return(NULL);
+
+ c_retval = xmlValidateNCName(value, space);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
libxml_xmlUCSIsMusicalSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
int c_retval;
@@ -8379,6 +8519,24 @@ libxml_xmlTextReaderConstXmlLang(PyObject *self ATTRIBUTE_UNUSED, PyObject *args
return(py_retval);
}
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlSchemaNewValidCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlSchemaValidCtxtPtr c_retval;
+ xmlSchemaPtr schema;
+ PyObject *pyobj_schema;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlSchemaNewValidCtxt", &pyobj_schema))
+ return(NULL);
+ schema = (xmlSchemaPtr) PySchema_Get(pyobj_schema);
+
+ c_retval = xmlSchemaNewValidCtxt(schema);
+ py_retval = libxml_xmlSchemaValidCtxtPtrWrap((xmlSchemaValidCtxtPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
PyObject *
libxml_xmlUCSIsKhmer(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
@@ -8745,6 +8903,24 @@ libxml_xmlCheckVersion(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
return(Py_None);
}
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlSchemaNewDocParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlSchemaParserCtxtPtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlSchemaNewDocParserCtxt", &pyobj_doc))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlSchemaNewDocParserCtxt(doc);
+ py_retval = libxml_xmlSchemaParserCtxtPtrWrap((xmlSchemaParserCtxtPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
#ifdef LIBXML_REGEXP_ENABLED
PyObject *
libxml_xmlRegFreeRegexp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
@@ -9700,23 +9876,6 @@ libxml_xmlNewDocRawNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
return(py_retval);
}
-#ifdef LIBXML_XPATH_ENABLED
-PyObject *
-libxml_xmlXPathConcatFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
- xmlXPathParserContextPtr ctxt;
- PyObject *pyobj_ctxt;
- int nargs;
-
- if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathConcatFunction", &pyobj_ctxt, &nargs))
- return(NULL);
- ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
-
- xmlXPathConcatFunction(ctxt, nargs);
- Py_INCREF(Py_None);
- return(Py_None);
-}
-
-#endif /* LIBXML_XPATH_ENABLED */
#ifdef LIBXML_SCHEMAS_ENABLED
PyObject *
libxml_xmlSchemaCollapseString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
@@ -10157,6 +10316,22 @@ libxml_xmlXPathNextPreceding(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
}
#endif /* LIBXML_XPATH_ENABLED */
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathIsNodeType(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * name;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlXPathIsNodeType", &name))
+ return(NULL);
+
+ c_retval = xmlXPathIsNodeType(name);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
PyObject *
libxml_xmlURISetScheme(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
xmlURIPtr URI;
@@ -10540,6 +10715,25 @@ libxml_xmlURIGetPort(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
return(py_retval);
}
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlSchemaDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ FILE * output;
+ PyObject *pyobj_output;
+ xmlSchemaPtr schema;
+ PyObject *pyobj_schema;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlSchemaDump", &pyobj_output, &pyobj_schema))
+ return(NULL);
+ output = (FILE *) PyFile_Get(pyobj_output);
+ schema = (xmlSchemaPtr) PySchema_Get(pyobj_schema);
+
+ xmlSchemaDump(output, schema);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
PyObject *
libxml_xmlParseFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
@@ -11060,26 +11254,6 @@ libxml_xmlXPathStringEvalNumber(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
}
#endif /* LIBXML_XPATH_ENABLED */
-PyObject *
-libxml_xmlReaderNewFd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
- PyObject *py_retval;
- int c_retval;
- xmlTextReaderPtr reader;
- PyObject *pyobj_reader;
- int fd;
- char * URL;
- char * encoding;
- int options;
-
- if (!PyArg_ParseTuple(args, (char *)"Oizzi:xmlReaderNewFd", &pyobj_reader, &fd, &URL, &encoding, &options))
- return(NULL);
- reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
-
- c_retval = xmlReaderNewFd(reader, fd, URL, encoding, options);
- py_retval = libxml_intWrap((int) c_retval);
- return(py_retval);
-}
-
#ifdef LIBXML_XPATH_ENABLED
PyObject *
libxml_xmlXPathCmpNodes(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
@@ -11532,17 +11706,18 @@ libxml_xmlStrsub(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
#ifdef LIBXML_XPATH_ENABLED
PyObject *
-libxml_xmlXPathIsNodeType(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
- PyObject *py_retval;
- int c_retval;
- xmlChar * name;
+libxml_xmlXPathConcatFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
- if (!PyArg_ParseTuple(args, (char *)"z:xmlXPathIsNodeType", &name))
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathConcatFunction", &pyobj_ctxt, &nargs))
return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
- c_retval = xmlXPathIsNodeType(name);
- py_retval = libxml_intWrap((int) c_retval);
- return(py_retval);
+ xmlXPathConcatFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
}
#endif /* LIBXML_XPATH_ENABLED */
diff --git a/python/libxml_wrap.h b/python/libxml_wrap.h
index 09fc77f..e821075 100644
--- a/python/libxml_wrap.h
+++ b/python/libxml_wrap.h
@@ -18,7 +18,10 @@
#include <libxml/xmlregexp.h>
#include <libxml/xmlautomata.h>
#include <libxml/xmlreader.h>
+#ifdef LIBXML_SCHEMAS_ENABLED
#include <libxml/relaxng.h>
+#include <libxml/xmlschemas.h>
+#endif
/**
* ATTRIBUTE_UNUSED:
@@ -165,6 +168,30 @@ typedef struct {
#define PyrelaxNgValidCtxt_Get(v) (((v) == Py_None) ? NULL : \
(((PyrelaxNgValidCtxt_Object *)(v))->obj))
+typedef struct {
+ PyObject_HEAD
+ xmlSchemaPtr obj;
+} PySchema_Object;
+
+#define PySchema_Get(v) (((v) == Py_None) ? NULL : \
+ (((PySchema_Object *)(v))->obj))
+
+typedef struct {
+ PyObject_HEAD
+ xmlSchemaParserCtxtPtr obj;
+} PySchemaParserCtxt_Object;
+
+#define PySchemaParserCtxt_Get(v) (((v) == Py_None) ? NULL : \
+ (((PySchemaParserCtxt_Object *)(v))->obj))
+
+typedef struct {
+ PyObject_HEAD
+ xmlSchemaValidCtxtPtr obj;
+} PySchemaValidCtxt_Object;
+
+#define PySchemaValidCtxt_Get(v) (((v) == Py_None) ? NULL : \
+ (((PySchemaValidCtxt_Object *)(v))->obj))
+
#endif /* LIBXML_SCHEMAS_ENABLED */
PyObject * libxml_intWrap(int val);
@@ -201,5 +228,9 @@ xmlXPathObjectPtr libxml_xmlXPathObjectPtrConvert(PyObject * obj);
PyObject * libxml_xmlRelaxNGPtrWrap(xmlRelaxNGPtr ctxt);
PyObject * libxml_xmlRelaxNGParserCtxtPtrWrap(xmlRelaxNGParserCtxtPtr ctxt);
PyObject * libxml_xmlRelaxNGValidCtxtPtrWrap(xmlRelaxNGValidCtxtPtr valid);
+PyObject * libxml_xmlSchemaPtrWrap(xmlSchemaPtr ctxt);
+PyObject * libxml_xmlSchemaParserCtxtPtrWrap(xmlSchemaParserCtxtPtr ctxt);
+PyObject * libxml_xmlSchemaValidCtxtPtrWrap(xmlSchemaValidCtxtPtr valid);
#endif /* LIBXML_SCHEMAS_ENABLED */
PyObject * libxml_xmlErrorPtrWrap(xmlErrorPtr error);
+PyObject * libxml_xmlSchemaSetValidErrors(PyObject * self, PyObject * args);
diff --git a/python/setup.py b/python/setup.py
index eb39621..f094b56 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.11",
+ version = "2.6.13",
description = descr,
author = "Daniel Veillard",
author_email = "veillard@redhat.com",
diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am
index 259a1bf..722e0ec 100644
--- a/python/tests/Makefile.am
+++ b/python/tests/Makefile.am
@@ -32,6 +32,7 @@ PYTESTS= \
ctxterror.py\
readererr.py\
relaxng.py \
+ schema.py \
thread2.py \
sync.py \
tstLastError.py \
@@ -46,7 +47,7 @@ EXTRA_DIST = $(PYTESTS) $(XMLS)
if WITH_PYTHON
tests: $(PYTESTS)
- echo "## running Python regression tests"
+ @echo "## running Python regression tests"
-@(PYTHONPATH="..:../.libs:$(srcdir)/..:$$PYTHONPATH" ; \
export PYTHONPATH; \
for test in $(PYTESTS) ; \
diff --git a/python/tests/Makefile.in b/python/tests/Makefile.in
index f5e50ec..dfef491 100644
--- a/python/tests/Makefile.in
+++ b/python/tests/Makefile.in
@@ -69,6 +69,8 @@ CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
+CYGWIN_EXTRA_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@
+CYGWIN_EXTRA_PYTHON_LIBADD = @CYGWIN_EXTRA_PYTHON_LIBADD@
DEBUG_OBJ = @DEBUG_OBJ@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
@@ -101,6 +103,7 @@ LIBXML_MAJOR_VERSION = @LIBXML_MAJOR_VERSION@
LIBXML_MICRO_VERSION = @LIBXML_MICRO_VERSION@
LIBXML_MINOR_VERSION = @LIBXML_MINOR_VERSION@
LIBXML_VERSION = @LIBXML_VERSION@
+LIBXML_VERSION_EXTRA = @LIBXML_VERSION_EXTRA@
LIBXML_VERSION_INFO = @LIBXML_VERSION_INFO@
LIBXML_VERSION_NUMBER = @LIBXML_VERSION_NUMBER@
LN_S = @LN_S@
@@ -118,6 +121,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PATTERN_TEST = @PATTERN_TEST@
+PERL = @PERL@
PYTHON = @PYTHON@
PYTHON_INCLUDES = @PYTHON_INCLUDES@
PYTHON_SITE_PACKAGES = @PYTHON_SITE_PACKAGES@
@@ -274,6 +278,7 @@ PYTESTS = \
ctxterror.py\
readererr.py\
relaxng.py \
+ schema.py \
thread2.py \
sync.py \
tstLastError.py \
@@ -445,7 +450,7 @@ uninstall-am: uninstall-info-am
@WITH_PYTHON_TRUE@tests: $(PYTESTS)
-@WITH_PYTHON_TRUE@ echo "## running Python regression tests"
+@WITH_PYTHON_TRUE@ @echo "## running Python regression tests"
@WITH_PYTHON_TRUE@ -@(PYTHONPATH="..:../.libs:$(srcdir)/..:$$PYTHONPATH" ; \
@WITH_PYTHON_TRUE@ export PYTHONPATH; \
@WITH_PYTHON_TRUE@ for test in $(PYTESTS) ; \
diff --git a/python/tests/schema.py b/python/tests/schema.py
new file mode 100755
index 0000000..bfa8423
--- /dev/null
+++ b/python/tests/schema.py
@@ -0,0 +1,52 @@
+#!/usr/bin/python -u
+import libxml2
+import sys
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+schema="""<?xml version="1.0" encoding="iso-8859-1"?>
+<schema xmlns = "http://www.w3.org/2001/XMLSchema">
+ <element name = "Customer">
+ <complexType>
+ <sequence>
+ <element name = "FirstName" type = "string" />
+ <element name = "MiddleInitial" type = "string" />
+ <element name = "LastName" type = "string" />
+ </sequence>
+ <attribute name = "customerID" type = "integer" />
+ </complexType>
+ </element>
+</schema>"""
+
+instance="""<?xml version="1.0" encoding="iso-8859-1"?>
+<Customer customerID = "24332">
+ <FirstName>Raymond</FirstName>
+ <MiddleInitial>G</MiddleInitial>
+ <LastName>Bayliss</LastName>
+</Customer>
+"""
+
+ctxt_parser = libxml2.schemaNewMemParserCtxt(schema, len(schema))
+ctxt_schema = ctxt_parser.schemaParse()
+ctxt_valid = ctxt_schema.schemaNewValidCtxt()
+doc = libxml2.parseDoc(instance)
+ret = doc.schemaValidateDoc(ctxt_valid)
+if ret != 0:
+ print "error doing schema validation"
+ sys.exit(1)
+
+doc.freeDoc()
+del ctxt_parser
+del ctxt_schema
+del ctxt_valid
+libxml2.schemaCleanupTypes()
+
+# 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/types.c b/python/types.c
index 42279d0..fa91a65 100644
--- a/python/types.c
+++ b/python/types.c
@@ -640,6 +640,63 @@ libxml_xmlRelaxNGValidCtxtPtrWrap(xmlRelaxNGValidCtxtPtr valid)
(char *) "xmlRelaxNGValidCtxtPtr", NULL);
return (ret);
}
+
+PyObject *
+libxml_xmlSchemaPtrWrap(xmlSchemaPtr ctxt)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlSchemaPtrWrap: ctxt = %p\n", ctxt);
+#endif
+ if (ctxt == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ ret =
+ PyCObject_FromVoidPtrAndDesc((void *) ctxt,
+ (char *) "xmlSchemaPtr", NULL);
+ return (ret);
+}
+
+PyObject *
+libxml_xmlSchemaParserCtxtPtrWrap(xmlSchemaParserCtxtPtr ctxt)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlSchemaParserCtxtPtrWrap: ctxt = %p\n", ctxt);
+#endif
+ if (ctxt == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ ret =
+ PyCObject_FromVoidPtrAndDesc((void *) ctxt,
+ (char *) "xmlSchemaParserCtxtPtr", NULL);
+
+ return (ret);
+}
+
+PyObject *
+libxml_xmlSchemaValidCtxtPtrWrap(xmlSchemaValidCtxtPtr valid)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlSchemaValidCtxtPtrWrap: valid = %p\n", valid);
+#endif
+ if (valid == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+
+ ret =
+ PyCObject_FromVoidPtrAndDesc((void *) valid,
+ (char *) "xmlSchemaValidCtxtPtr", NULL);
+
+ return (ret);
+}
#endif /* LIBXML_SCHEMAS_ENABLED */
PyObject *