1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-05 19:01:18 +03:00

Add support for xpathRegisterVariable in Python

This commit is contained in:
Shaun McCance
2012-09-19 13:41:56 -04:00
committed by Daniel Veillard
parent 483272f3f0
commit 519bc6a3ab
3 changed files with 35 additions and 1 deletions

View File

@ -2329,6 +2329,32 @@ libxml_xmlRegisterXPathFunction(ATTRIBUTE_UNUSED PyObject * self,
return (py_retval);
}
PyObject *
libxml_xmlXPathRegisterVariable(ATTRIBUTE_UNUSED PyObject * self,
PyObject * args)
{
PyObject *py_retval;
int c_retval = 0;
xmlChar *name;
xmlChar *ns_uri;
xmlXPathContextPtr ctx;
xmlXPathObjectPtr val;
PyObject *pyobj_ctx;
PyObject *pyobj_value;
if (!PyArg_ParseTuple
(args, (char *) "OszO:xpathRegisterVariable", &pyobj_ctx, &name,
&ns_uri, &pyobj_value))
return (NULL);
ctx = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctx);
val = libxml_xmlXPathObjectPtrConvert(pyobj_value);
c_retval = xmlXPathRegisterVariableNS(ctx, name, ns_uri, val);
py_retval = libxml_intWrap(c_retval);
return (py_retval);
}
/************************************************************************
* *
* Global properties access *