diff options
author | Mike Hommey <glandium@debian.org> | 2005-07-12 19:58:48 +0000 |
---|---|---|
committer | Mike Hommey <glandium@debian.org> | 2005-07-12 19:58:48 +0000 |
commit | 112cb5bb5475afec1c1cbf1d6728ce4880d0fee8 (patch) | |
tree | 6c34596134f8665ebc180f29b50915dc70bbe5c1 /python/libxml.c | |
parent | 0fc063df3ab2ad380d532d210dd1001de473e51b (diff) | |
download | libxml2-112cb5bb5475afec1c1cbf1d6728ce4880d0fee8.tar.gz |
Load /tmp/tmp.zfIyNk/libxml2-2.6.20 intoupstream/2.6.20
packages/libxml2/branches/upstream/current.
Diffstat (limited to 'python/libxml.c')
-rw-r--r-- | python/libxml.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/python/libxml.c b/python/libxml.c index b18f887..8fc63f8 100644 --- a/python/libxml.c +++ b/python/libxml.c @@ -2661,6 +2661,55 @@ libxml_xmlNodeGetNsDefs(ATTRIBUTE_UNUSED PyObject * self, PyObject * args) } PyObject * +libxml_xmlNodeRemoveNsDef(ATTRIBUTE_UNUSED PyObject * self, PyObject * args) +{ + PyObject *py_retval; + xmlNsPtr ns, prev; + xmlNodePtr node; + PyObject *pyobj_node; + xmlChar *href; + xmlNsPtr c_retval; + + if (!PyArg_ParseTuple + (args, (char *) "Oz:xmlNodeRemoveNsDef", &pyobj_node, &href)) + return (NULL); + node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); + ns = NULL; + + if ((node == NULL) || (node->type != XML_ELEMENT_NODE)) { + Py_INCREF(Py_None); + return (Py_None); + } + + if (href == NULL) { + ns = node->nsDef; + node->nsDef = NULL; + c_retval = 0; + } + else { + prev = NULL; + ns = node->nsDef; + while (ns != NULL) { + if (xmlStrEqual(ns->href, href)) { + if (prev != NULL) + prev->next = ns->next; + else + node->nsDef = ns->next; + ns->next = NULL; + c_retval = 0; + break; + } + prev = ns; + ns = ns->next; + } + } + + c_retval = ns; + py_retval = libxml_xmlNsPtrWrap((xmlNsPtr) c_retval); + return (py_retval); +} + +PyObject * libxml_xmlNodeGetNs(ATTRIBUTE_UNUSED PyObject * self, PyObject * args) { PyObject *py_retval; @@ -3640,6 +3689,7 @@ static PyMethodDef libxmlMethods[] = { {(char *) "type", libxml_type, METH_VARARGS, NULL}, {(char *) "doc", libxml_doc, METH_VARARGS, NULL}, {(char *) "xmlNewNode", libxml_xmlNewNode, METH_VARARGS, NULL}, + {(char *) "xmlNodeRemoveNsDef", libxml_xmlNodeRemoveNsDef, METH_VARARGS, NULL}, {(char *)"xmlSetValidErrors", libxml_xmlSetValidErrors, METH_VARARGS, NULL}, {(char *)"xmlFreeValidCtxt", libxml_xmlFreeValidCtxt, METH_VARARGS, NULL}, #ifdef LIBXML_OUTPUT_ENABLED |