diff options
| author | Nicolas Clapies <nclapies@entrouvert.com> | 2004-12-07 11:29:34 +0000 |
|---|---|---|
| committer | Nicolas Clapies <nclapies@entrouvert.com> | 2004-12-07 11:29:34 +0000 |
| commit | f7b49995a83b24c3d93ff72ad3565839a626dcc1 (patch) | |
| tree | 0cf53035eaf31105f8e7af0af1aa71986efb54b8 /lasso/xml/dst_query_response.c | |
| parent | ea9081a279db2416e858763a5cb522553c44dd7e (diff) | |
| download | lasso-f7b49995a83b24c3d93ff72ad3565839a626dcc1.tar.gz lasso-f7b49995a83b24c3d93ff72ad3565839a626dcc1.tar.xz lasso-f7b49995a83b24c3d93ff72ad3565839a626dcc1.zip | |
Added support of specific service : now QueryResponse element can be used by services and inherits their name space.
Diffstat (limited to 'lasso/xml/dst_query_response.c')
| -rw-r--r-- | lasso/xml/dst_query_response.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/lasso/xml/dst_query_response.c b/lasso/xml/dst_query_response.c index 9ce6c291..af2788be 100644 --- a/lasso/xml/dst_query_response.c +++ b/lasso/xml/dst_query_response.c @@ -55,6 +55,41 @@ static struct XmlSnippet schema_snippets[] = { {NULL, 0, 0} }; +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_RESPONSE(node)->hrefServiceType, + LASSO_DST_QUERY_RESPONSE(node)->prefixServiceType); + xmlSetNs(xmlnode, ns); + insure_namespace(xmlnode, ns); + + return xmlnode; +} + /*****************************************************************************/ /* instance and class init functions */ /*****************************************************************************/ @@ -69,6 +104,9 @@ instance_init(LassoDstQueryResponse *node) node->id = NULL; node->itemIDRef = NULL; node->timeStamp = NULL; + + node->prefixServiceType = NULL; + node->hrefServiceType = NULL; } static void @@ -76,6 +114,8 @@ class_init(LassoDstQueryResponseClass *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, "QueryResponse"); lasso_node_class_add_snippets(nodeClass, schema_snippets); |
