diff options
| author | Nicolas Clapies <nclapies@entrouvert.com> | 2004-12-07 11:12:24 +0000 |
|---|---|---|
| committer | Nicolas Clapies <nclapies@entrouvert.com> | 2004-12-07 11:12:24 +0000 |
| commit | de149fd796ade794bd74a52c1a2d79d3e472207f (patch) | |
| tree | 1ee97b322bda4b2fe46e87a86d9cbc83b7e9a0c7 | |
| parent | 9e5e75d4b83075e738304eb89225796d146b41aa (diff) | |
| download | lasso-de149fd796ade794bd74a52c1a2d79d3e472207f.tar.gz lasso-de149fd796ade794bd74a52c1a2d79d3e472207f.tar.xz lasso-de149fd796ade794bd74a52c1a2d79d3e472207f.zip | |
Added support of specific service : now Query element can be used by services and inherits their name space.
| -rw-r--r-- | lasso/xml/dst_query.c | 36 | ||||
| -rw-r--r-- | lasso/xml/dst_query.h | 3 |
2 files changed, 39 insertions, 0 deletions
diff --git a/lasso/xml/dst_query.c b/lasso/xml/dst_query.c index 0641a9b9..b89de12f 100644 --- a/lasso/xml/dst_query.c +++ b/lasso/xml/dst_query.c @@ -55,6 +55,39 @@ static struct XmlSnippet schema_snippets[] = { static LassoNodeClass *parent_class = NULL; +static void +insure_namespace(xmlNode *xmlnode, xmlNs *ns) +{ + /* insure children are kept in same namespace */ + xmlNode *t; + + t = xmlnode->children; + while (t) { + if (t->type != XML_ELEMENT_NODE) { + t = t->next; + continue; + } + xmlSetNs(xmlnode, ns); + insure_namespace(t, ns); + t = t->next; + } +} + +static xmlNode* +get_xmlNode(LassoNode *node) +{ + xmlNode *xmlnode; + xmlNs *ns; + + xmlnode = parent_class->get_xmlNode(node); + ns = xmlNewNs(xmlnode, LASSO_DST_QUERY(node)->hrefServiceType, + LASSO_DST_QUERY(node)->prefixServiceType); + xmlSetNs(xmlnode, ns); + insure_namespace(xmlnode, ns); + + return xmlnode; +} + /*****************************************************************************/ /* instance and class init functions */ /*****************************************************************************/ @@ -67,6 +100,8 @@ instance_init(LassoDstQuery *node) node->QueryItem = NULL; node->id = NULL; node->itemID = NULL; + node->prefixServiceType = NULL; + node->hrefServiceType = NULL; } static void @@ -75,6 +110,7 @@ class_init(LassoDstQueryClass *klass) LassoNodeClass *nodeClass = LASSO_NODE_CLASS(klass); parent_class = g_type_class_peek_parent(klass); + nodeClass->get_xmlNode = get_xmlNode; nodeClass->node_data = g_new0(LassoNodeClassData, 1); lasso_node_class_set_nodename(nodeClass, "Query"); lasso_node_class_add_snippets(nodeClass, schema_snippets); diff --git a/lasso/xml/dst_query.h b/lasso/xml/dst_query.h index dfd65af6..b89fe704 100644 --- a/lasso/xml/dst_query.h +++ b/lasso/xml/dst_query.h @@ -56,6 +56,9 @@ struct _LassoDstQuery { char *id; char *itemID; + + char *prefixServiceType; + char *hrefServiceType; }; struct _LassoDstQueryClass { |
