summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorValery Febvre <vfebvre at easter-eggs.com>2004-06-02 13:22:43 +0000
committerValery Febvre <vfebvre at easter-eggs.com>2004-06-02 13:22:43 +0000
commita94e79361227eb5df8ae6581accaa9d67f3cbbaf (patch)
tree94c88fe7e81f535030e0849a0ce1a0a94141f776
parentd3594e19a72b29ef6e0f68b539c5499169c80953 (diff)
downloadlasso-a94e79361227eb5df8ae6581accaa9d67f3cbbaf.tar.gz
lasso-a94e79361227eb5df8ae6581accaa9d67f3cbbaf.tar.xz
lasso-a94e79361227eb5df8ae6581accaa9d67f3cbbaf.zip
Added lasso_node_get_child_content() method
-rw-r--r--lasso/xml/xml.c76
-rw-r--r--lasso/xml/xml.h7
2 files changed, 65 insertions, 18 deletions
diff --git a/lasso/xml/xml.c b/lasso/xml/xml.c
index b86d08c1..b53d9a2c 100644
--- a/lasso/xml/xml.c
+++ b/lasso/xml/xml.c
@@ -221,7 +221,7 @@ lasso_node_get_attrs(LassoNode *node)
/**
* lasso_node_get_child:
* @node: a LassoNode
- * @name: the name
+ * @name: the child name
* @href: the namespace (may be NULL)
*
* Gets child of node having given @name and namespace @href.
@@ -240,6 +240,28 @@ lasso_node_get_child(LassoNode *node,
}
/**
+ * lasso_node_get_child_content:
+ * @node: a LassoNode
+ * @name: the child name
+ * @href: the namespace (may be NULL)
+ *
+ * Gets child content of node having given @name and namespace @href.
+ *
+ * Return value: a new xmlChar * or NULL if no child found or no content is
+ * available. It's up to the caller to free the memory with xmlFree().
+ **/
+xmlChar *
+lasso_node_get_child_content(LassoNode *node,
+ const xmlChar *name,
+ const xmlChar *href)
+{
+ g_return_val_if_fail (LASSO_IS_NODE(node), NULL);
+
+ LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
+ return (class->get_child_content(node, name, href));
+}
+
+/**
* lasso_node_get_children:
* @node: a LassoNode
*
@@ -736,6 +758,23 @@ lasso_node_impl_get_child(LassoNode *node,
return (NULL);
}
+static xmlChar *
+lasso_node_impl_get_child_content(LassoNode *node,
+ const xmlChar *name,
+ const xmlChar *href)
+{
+ g_return_val_if_fail (LASSO_IS_NODE(node), NULL);
+ g_return_val_if_fail (name != NULL, NULL);
+
+ LassoNode *child = lasso_node_get_child(node, name, href);
+ xmlChar *content;
+
+ content = lasso_node_get_content(child);
+ lasso_node_destroy(child);
+
+ return (content);
+}
+
static GPtrArray *
lasso_node_impl_get_children(LassoNode *node)
{
@@ -1238,23 +1277,24 @@ lasso_node_class_init(LassoNodeClass *class)
GObjectClass *gobject_class = G_OBJECT_CLASS(class);
/* virtual public methods */
- class->copy = lasso_node_impl_copy;
- class->destroy = lasso_node_impl_destroy;
- class->dump = lasso_node_impl_dump;
- class->export = lasso_node_impl_export;
- class->export_to_base64 = lasso_node_impl_export_to_base64;
- class->export_to_query = lasso_node_impl_export_to_query;
- class->export_to_soap = lasso_node_impl_export_to_soap;
- class->get_attr = lasso_node_impl_get_attr;
- class->get_attr_value = lasso_node_impl_get_attr_value;
- class->get_attrs = lasso_node_impl_get_attrs;
- class->get_child = lasso_node_impl_get_child;
- class->get_children = lasso_node_impl_get_children;
- class->get_content = lasso_node_impl_get_content;
- class->get_name = lasso_node_impl_get_name;
- class->import = lasso_node_impl_import;
- class->rename_prop = lasso_node_impl_rename_prop;
- class->verify_signature = lasso_node_impl_verify_signature;
+ class->copy = lasso_node_impl_copy;
+ class->destroy = lasso_node_impl_destroy;
+ class->dump = lasso_node_impl_dump;
+ class->export = lasso_node_impl_export;
+ class->export_to_base64 = lasso_node_impl_export_to_base64;
+ class->export_to_query = lasso_node_impl_export_to_query;
+ class->export_to_soap = lasso_node_impl_export_to_soap;
+ class->get_attr = lasso_node_impl_get_attr;
+ class->get_attr_value = lasso_node_impl_get_attr_value;
+ class->get_attrs = lasso_node_impl_get_attrs;
+ class->get_child = lasso_node_impl_get_child;
+ class->get_child_content = lasso_node_impl_get_child_content;
+ class->get_children = lasso_node_impl_get_children;
+ class->get_content = lasso_node_impl_get_content;
+ class->get_name = lasso_node_impl_get_name;
+ class->import = lasso_node_impl_import;
+ class->rename_prop = lasso_node_impl_rename_prop;
+ class->verify_signature = lasso_node_impl_verify_signature;
/* virtual private methods */
class->add_child = lasso_node_impl_add_child;
class->add_signature = lasso_node_impl_add_signature;
diff --git a/lasso/xml/xml.h b/lasso/xml/xml.h
index 320c6bdf..b6b8dcc8 100644
--- a/lasso/xml/xml.h
+++ b/lasso/xml/xml.h
@@ -79,6 +79,9 @@ struct _LassoNodeClass {
LassoNode* (* get_child) (LassoNode *node,
const xmlChar *name,
const xmlChar *href);
+ xmlChar* (* get_child_content)(LassoNode *node,
+ const xmlChar *name,
+ const xmlChar *href);
GPtrArray* (* get_children) (LassoNode *node);
xmlChar* (* get_content) (LassoNode *node);
const xmlChar* (* get_name) (LassoNode *node);
@@ -153,6 +156,10 @@ LASSO_EXPORT LassoNode* lasso_node_get_child (LassoNode *node,
const xmlChar *name,
const xmlChar *href);
+LASSO_EXPORT xmlChar * lasso_node_get_child_content(LassoNode *node,
+ const xmlChar *name,
+ const xmlChar *href);
+
LASSO_EXPORT GPtrArray* lasso_node_get_children (LassoNode *node);
LASSO_EXPORT xmlChar* lasso_node_get_content (LassoNode *node);