diff options
author | Frederic Peters <fpeters@entrouvert.com> | 2004-11-17 23:04:57 +0000 |
---|---|---|
committer | Frederic Peters <fpeters@entrouvert.com> | 2004-11-17 23:04:57 +0000 |
commit | 59bdda3549b13cbe97ce49fdb541f8bad006f08e (patch) | |
tree | 5f8809c208fafea2e5fda8078b032636ebece261 /lasso/xml/xml.c | |
parent | cfc07351978eef632c1b06f06f7246c2860cfc9c (diff) | |
download | lasso-59bdda3549b13cbe97ce49fdb541f8bad006f08e.tar.gz lasso-59bdda3549b13cbe97ce49fdb541f8bad006f08e.tar.xz lasso-59bdda3549b13cbe97ce49fdb541f8bad006f08e.zip |
use same "xmlsnippets" (name will probably change) to build xml nodes
Diffstat (limited to 'lasso/xml/xml.c')
-rw-r--r-- | lasso/xml/xml.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/lasso/xml/xml.c b/lasso/xml/xml.c index 8b251578..3702887b 100644 --- a/lasso/xml/xml.c +++ b/lasso/xml/xml.c @@ -744,7 +744,7 @@ lasso_node_init_xml_with_snippets(xmlNode *node, struct XmlSnippet *snippets) if (snippets[i].type == 'c') /* content */ *(snippets[i].value) = xmlNodeGetContent(t); if (snippets[i].type == 'i') /* special case for name identifier */ - *(snippets[i].value) = + *(snippets[i].value) = (void*) lasso_saml_name_identifier_new_from_xmlNode(t); break; } @@ -752,3 +752,30 @@ lasso_node_init_xml_with_snippets(xmlNode *node, struct XmlSnippet *snippets) } +void +lasso_node_build_xml_with_snippets(xmlNode *node, struct XmlSnippet *snippets) +{ + int i; + + for (i = 0; snippets[i].name; i++) { + if (*(snippets[i].value) == NULL) + continue; + if (snippets[i].type == 'n') + xmlAddChild(node, lasso_node_get_xmlNode( + LASSO_NODE(*(snippets[i].value)))); + if (snippets[i].type == 'c') + xmlNewTextChild(node, NULL, snippets[i].name, + (char*)(*(snippets[i].value))); + if (snippets[i].type == 'i') { + xmlNode *t; + xmlNs *xmlns; + xmlns = xmlNewNs(node, LASSO_LIB_HREF, LASSO_LIB_PREFIX); + + t = xmlAddChild(node, lasso_node_get_xmlNode( + LASSO_NODE(*(snippets[i].value)))); + xmlNodeSetName(t, snippets[i].name); + xmlSetNs(t, xmlns); + } + } +} + |