summaryrefslogtreecommitdiffstats
path: root/lasso/xml/lib_logout_request.c
diff options
context:
space:
mode:
authorFrederic Peters <fpeters@entrouvert.com>2004-11-17 23:04:57 +0000
committerFrederic Peters <fpeters@entrouvert.com>2004-11-17 23:04:57 +0000
commit59bdda3549b13cbe97ce49fdb541f8bad006f08e (patch)
tree5f8809c208fafea2e5fda8078b032636ebece261 /lasso/xml/lib_logout_request.c
parentcfc07351978eef632c1b06f06f7246c2860cfc9c (diff)
downloadlasso-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/lib_logout_request.c')
-rw-r--r--lasso/xml/lib_logout_request.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/lasso/xml/lib_logout_request.c b/lasso/xml/lib_logout_request.c
index f70aa97e..26fa1705 100644
--- a/lasso/xml/lib_logout_request.c
+++ b/lasso/xml/lib_logout_request.c
@@ -61,27 +61,29 @@ From liberty-metadata-v1.0.xsd:
/* private methods */
/*****************************************************************************/
+#define snippets() \
+ LassoLibLogoutRequest *request = LASSO_LIB_LOGOUT_REQUEST(node); \
+ struct XmlSnippet snippets[] = { \
+ { "ProviderID", 'c', (void**)&(request->ProviderID) }, \
+ { "NameIdentifier", 'n', (void**)&(request->NameIdentifier) }, \
+ { "SessionIndex", 'c', (void**)&(request->SessionIndex) }, \
+ { "RelayState", 'c', (void**)&(request->RelayState) }, \
+ { NULL, 0, NULL} \
+ };
+
static LassoNodeClass *parent_class = NULL;
static xmlNode*
get_xmlNode(LassoNode *node)
{
- LassoLibLogoutRequest *request = LASSO_LIB_LOGOUT_REQUEST(node);
xmlNode *xmlnode;
+ snippets();
xmlnode = parent_class->get_xmlNode(node);
xmlNodeSetName(xmlnode, "LogoutRequest");
xmlSetNs(xmlnode, xmlNewNs(xmlnode, LASSO_LIB_HREF, LASSO_LIB_PREFIX));
- if (request->Extension)
- xmlNewTextChild(xmlnode, NULL, "Extension", request->Extension);
- if (request->ProviderID)
- xmlNewTextChild(xmlnode, NULL, "ProviderID", request->ProviderID);
- if (request->NameIdentifier)
- xmlAddChild(xmlnode, lasso_node_get_xmlNode(LASSO_NODE(request->NameIdentifier)));
- if (request->SessionIndex)
- xmlNewTextChild(xmlnode, NULL, "SessionIndex", request->SessionIndex);
- if (request->RelayState)
- xmlNewTextChild(xmlnode, NULL, "RelayState", request->RelayState);
+ lasso_node_build_xml_with_snippets(xmlnode, snippets);
+
if (request->consent)
xmlSetProp(xmlnode, "consent", request->consent);
@@ -169,14 +171,7 @@ init_from_query(LassoNode *node, char **query_fields)
static int
init_from_xml(LassoNode *node, xmlNode *xmlnode)
{
- LassoLibLogoutRequest *request = LASSO_LIB_LOGOUT_REQUEST(node);
- struct XmlSnippet snippets[] = {
- { "ProviderID", 'c', (void**)&(request->ProviderID) },
- { "NameIdentifier", 'n', (void**)&(request->NameIdentifier) },
- { "SessionIndex", 'c', (void**)&(request->SessionIndex) },
- { "RelayState", 'c', (void**)&(request->RelayState) },
- { NULL, 0, NULL}
- };
+ snippets();
if (parent_class->init_from_xml(node, xmlnode))
return -1;