diff options
author | Frederic Peters <fpeters@entrouvert.com> | 2008-04-29 12:04:36 +0000 |
---|---|---|
committer | Frederic Peters <fpeters@entrouvert.com> | 2008-04-29 12:04:36 +0000 |
commit | 87f9e0f350b879b7d721889cc6fbc6f878f4cd0f (patch) | |
tree | 0cb15d69dc0950ba47de2f40033ca42b689a7a09 /bindings/lang_python_wrapper_top.c | |
parent | c8762f405baaac8cbb6475b39d4fbd701a34060a (diff) | |
download | lasso-87f9e0f350b879b7d721889cc6fbc6f878f4cd0f.tar.gz lasso-87f9e0f350b879b7d721889cc6fbc6f878f4cd0f.tar.xz lasso-87f9e0f350b879b7d721889cc6fbc6f878f4cd0f.zip |
[project @ fpeters@0d.be-20071103211651-8vperiqd97t0987s]
support for list of xmlNode* (such as LibAuthnRequest/Extension)
Original author: Frederic Peters <fpeters@0d.be>
Date: 2007-11-03 22:16:51.610000+01:00
Diffstat (limited to 'bindings/lang_python_wrapper_top.c')
-rw-r--r-- | bindings/lang_python_wrapper_top.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/bindings/lang_python_wrapper_top.c b/bindings/lang_python_wrapper_top.c index a80bbde3..1e9c682f 100644 --- a/bindings/lang_python_wrapper_top.c +++ b/bindings/lang_python_wrapper_top.c @@ -7,6 +7,7 @@ GQuark lasso_wrapper_key; PyMODINIT_FUNC init_lasso(void); static PyObject* get_pystring_from_xml_node(xmlNode *xmlnode); +static xmlNode* get_xml_node_from_pystring(PyObject *string); static PyObject* get_dict_from_hashtable_of_strings(GHashTable *value); static PyObject* get_dict_from_hashtable_of_objects(GHashTable *value); static PyObject* PyGObjectPtr_New(GObject *obj); @@ -136,6 +137,22 @@ get_pystring_from_xml_node(xmlNode *xmlnode) return pystring; } +static xmlNode* +get_xml_node_from_pystring(PyObject *string) { + xmlDoc *doc; + xmlNode *node; + + doc = xmlReadDoc((xmlChar*)PyString_AsString(string), NULL, NULL, XML_PARSE_NONET); + node = xmlDocGetRootElement(doc); + if (node != NULL) { + node = xmlCopyNode(node, 1); + } + xmlFreeDoc(doc); + + return node; +} + + /* wrapper around GObject */ typedef struct { |