summaryrefslogtreecommitdiffstats
path: root/bindings/lang_python_wrapper_top.c
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/lang_python_wrapper_top.c')
-rw-r--r--bindings/lang_python_wrapper_top.c17
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 {