summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2010-01-04 09:13:59 +0000
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2010-01-04 09:13:59 +0000
commit7e22acdd2c784fd4ce279ba2a7fe79ba490d02a0 (patch)
treedfb0119f0072c0cd91065f14d9cc407f0ec4be6f
parenta2bfa25d7148ec7d6745ef080ec8a963a9f3392d (diff)
downloadlasso-7e22acdd2c784fd4ce279ba2a7fe79ba490d02a0.tar.gz
lasso-7e22acdd2c784fd4ce279ba2a7fe79ba490d02a0.tar.xz
lasso-7e22acdd2c784fd4ce279ba2a7fe79ba490d02a0.zip
Core XML: in xml.{c,h}, add new function lasso_node_get_name to get the element name for an object
-rw-r--r--lasso/xml/xml.c24
-rw-r--r--lasso/xml/xml.h3
2 files changed, 27 insertions, 0 deletions
diff --git a/lasso/xml/xml.c b/lasso/xml/xml.c
index 8d1f8c7a..96e57ede 100644
--- a/lasso/xml/xml.c
+++ b/lasso/xml/xml.c
@@ -2769,3 +2769,27 @@ lasso_node_get_xmlnode_for_any_type(LassoNode *node, xmlNode *cur)
}
}
}
+
+/**
+ * lasso_node_get_name:
+ * @node: a #LassoNode
+ *
+ * Return the XML element name for this object, the one that would be used in the XML dump of this
+ * object.
+ *
+ * Return value: the name of the object, the value must not be stored.
+ */
+const char*
+lasso_node_get_name(LassoNode *node)
+{
+ struct _CustomElement *custom_element;
+ LassoNodeClass *klass;
+ g_return_val_if_fail(LASSO_IS_NODE(node), NULL);
+
+ custom_element = _lasso_node_get_custom_element(node);
+ if (custom_element && custom_element->nodename) {
+ return custom_element->nodename;
+ }
+ klass = LASSO_NODE_GET_CLASS(node);
+ return klass->node_data->node_name;
+}
diff --git a/lasso/xml/xml.h b/lasso/xml/xml.h
index 5758da50..afbbe41e 100644
--- a/lasso/xml/xml.h
+++ b/lasso/xml/xml.h
@@ -158,6 +158,8 @@ LASSO_EXPORT void lasso_node_set_custom_namespace(LassoNode *node, char *prefix,
LASSO_EXPORT void lasso_node_set_custom_nodename(LassoNode *node, char *nodename);
+LASSO_EXPORT const char* lasso_node_get_name(LassoNode *node);
+
LASSO_EXPORT LassoMessageFormat lasso_node_init_from_message(LassoNode *node, const char *message);
LASSO_EXPORT gboolean lasso_node_init_from_query(LassoNode *node, const char *query);
@@ -171,6 +173,7 @@ LASSO_EXPORT char* lasso_get_prefix_for_dst_service_href(const char *href);
LASSO_EXPORT void lasso_register_idwsf2_dst_service(const gchar *prefix, const gchar *href);
LASSO_EXPORT gchar* lasso_get_prefix_for_idwsf2_dst_service_href(const gchar *href);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */