diff options
Diffstat (limited to 'lasso/xml/lib_status_response.c')
-rw-r--r-- | lasso/xml/lib_status_response.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/lasso/xml/lib_status_response.c b/lasso/xml/lib_status_response.c index e8874dcd..a68c403b 100644 --- a/lasso/xml/lib_status_response.c +++ b/lasso/xml/lib_status_response.c @@ -58,26 +58,27 @@ From liberty-metadata-v1.0.xsd: /* private methods */ /*****************************************************************************/ +#define snippets() \ + LassoLibStatusResponse *response = LASSO_LIB_STATUS_RESPONSE(node); \ + struct XmlSnippet snippets[] = { \ + { "ProviderID", 'c', (void**)&(response->ProviderID) }, \ + { "Status", 'n', (void**)&(response->Status) }, \ + { "RelayState", 'c', (void**)&(response->RelayState) }, \ + { NULL, 0, NULL} \ + }; + static LassoNodeClass *parent_class = NULL; static xmlNode* get_xmlNode(LassoNode *node) { xmlNode *xmlnode; - LassoLibStatusResponse *response = LASSO_LIB_STATUS_RESPONSE(node); + snippets(); xmlnode = parent_class->get_xmlNode(node); xmlNodeSetName(xmlnode, "StatusResponse"); xmlSetNs(xmlnode, xmlNewNs(xmlnode, LASSO_LIB_HREF, LASSO_LIB_PREFIX)); - - if (response->ProviderID) - xmlNewTextChild(xmlnode, NULL, "ProviderID", response->ProviderID); - - if (response->Status) - xmlAddChild(xmlnode, lasso_node_get_xmlNode(LASSO_NODE(response->Status))); - - if (response->RelayState) - xmlNewTextChild(xmlnode, NULL, "RelayState", response->RelayState); + lasso_node_build_xml_with_snippets(xmlnode, snippets); return xmlnode; } @@ -85,13 +86,7 @@ get_xmlNode(LassoNode *node) static int init_from_xml(LassoNode *node, xmlNode *xmlnode) { - LassoLibStatusResponse *response = LASSO_LIB_STATUS_RESPONSE(node); - struct XmlSnippet snippets[] = { - { "ProviderID", 'c', (void**)&(response->ProviderID) }, - { "Status", 'n', (void**)&(response->Status) }, - { "RelayState", 'c', (void**)&(response->RelayState) }, - { NULL, 0, NULL} - }; + snippets(); if (parent_class->init_from_xml(node, xmlnode)) return -1; |