mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-06-13 19:21:37 +03:00
hardened the addChild function added accessors needed for xmlNode, a bit
* tree.c: hardened the addChild function * python/generator.py python/libxml.c python/libxml2-python-api.xml python/libxml2class.txt python/libxml_wrap.h python/TODO: added accessors needed for xmlNode, a bit more testing and extension of interfaces * python/tests/Makefile.am python/tests/build.py: added a test build from scratch/save/load/check Daniel
This commit is contained in:
@ -808,6 +808,51 @@ libxml_type(PyObject *self, PyObject *args)
|
||||
return resultobj;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Specific accessor functions *
|
||||
* *
|
||||
************************************************************************/
|
||||
PyObject *
|
||||
libxml_xmlNodeGetNsDefs(PyObject *self, PyObject *args) {
|
||||
PyObject *py_retval;
|
||||
xmlNsPtr c_retval;
|
||||
xmlNodePtr node;
|
||||
PyObject *pyobj_node;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O:xmlNodeGetNsDefs", &pyobj_node))
|
||||
return(NULL);
|
||||
node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
|
||||
|
||||
if ((node == NULL) || (node->type != XML_ELEMENT_NODE)) {
|
||||
Py_INCREF(Py_None);
|
||||
return(Py_None);
|
||||
}
|
||||
c_retval = node->nsDef;
|
||||
py_retval = libxml_xmlNsPtrWrap((xmlNsPtr) c_retval);
|
||||
return(py_retval);
|
||||
}
|
||||
|
||||
PyObject *
|
||||
libxml_xmlNodeGetNs(PyObject *self, PyObject *args) {
|
||||
PyObject *py_retval;
|
||||
xmlNsPtr c_retval;
|
||||
xmlNodePtr node;
|
||||
PyObject *pyobj_node;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O:xmlNodeGetNs", &pyobj_node))
|
||||
return(NULL);
|
||||
node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
|
||||
|
||||
if ((node == NULL) || (node->type != XML_ELEMENT_NODE)) {
|
||||
Py_INCREF(Py_None);
|
||||
return(Py_None);
|
||||
}
|
||||
c_retval = node->ns;
|
||||
py_retval = libxml_xmlNsPtrWrap((xmlNsPtr) c_retval);
|
||||
return(py_retval);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* The registration stuff *
|
||||
|
Reference in New Issue
Block a user