summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2009-09-11 15:51:57 +0000
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2009-09-11 15:51:57 +0000
commit550678afe9924536753e1eb64792dbebbeef55af (patch)
tree039672fd547c2e83612446ddeadfe47be3921022
parentaa1217338319d884d831d36356c198ee27c7e85d (diff)
XML ID-WSF: Fix parsing of most ID-WSF elements
* lasso/xml/disco_send_single_logout.c: * lasso/xml/id-wsf-2.0/sb2_user_interaction_header.c: * lasso/xml/id-wsf-2.0/subsref_app_data.c: * lasso/xml/xml.c: lots of ID-WSF 1.0/2.0 classes were not passing the new non-regression test on serialization/deserialization. The main reason was the absence of mapping for their namespace in the prefix_from_href_and_nodename function. The other reason is that some class name does not correspond 1-to-1 to the element name (SendSingleLogOut vs. SendSingleLogout, notice the capitalised 'O'). The last problem was that mapping from nodes to GObject classes was done after default mapping ("Lasso<prefix><node_name>"), now it's done before, to reflect the fact that it is a more specialized mapping.
-rw-r--r--lasso/xml/disco_send_single_logout.c2
-rw-r--r--lasso/xml/id-wsf-2.0/sb2_user_interaction_header.c3
-rw-r--r--lasso/xml/id-wsf-2.0/subsref_app_data.c2
-rw-r--r--lasso/xml/xml.c29
4 files changed, 28 insertions, 8 deletions
diff --git a/lasso/xml/disco_send_single_logout.c b/lasso/xml/disco_send_single_logout.c
index 1aa6e65b..8dba2858 100644
--- a/lasso/xml/disco_send_single_logout.c
+++ b/lasso/xml/disco_send_single_logout.c
@@ -24,6 +24,7 @@
#include "private.h"
#include "disco_send_single_logout.h"
+#include "../registry.h"
/**
* SECTION:disco_send_single_logout
@@ -64,6 +65,7 @@ class_init(LassoDiscoSendSingleLogoutClass *klass)
lasso_node_class_set_nodename(nclass, "SendSingleLogOut");
lasso_node_class_set_ns(nclass, LASSO_DISCO_HREF, LASSO_DISCO_PREFIX);
lasso_node_class_add_snippets(nclass, schema_snippets);
+ lasso_registry_default_add_direct_mapping(LASSO_DISCO_HREF, "SendSingleLogOut", LASSO_LASSO_HREF, "LassoDiscoSendSingleLogout");
}
GType
diff --git a/lasso/xml/id-wsf-2.0/sb2_user_interaction_header.c b/lasso/xml/id-wsf-2.0/sb2_user_interaction_header.c
index 4696f9be..794ca344 100644
--- a/lasso/xml/id-wsf-2.0/sb2_user_interaction_header.c
+++ b/lasso/xml/id-wsf-2.0/sb2_user_interaction_header.c
@@ -24,6 +24,7 @@
#include "../private.h"
#include "sb2_user_interaction_header.h"
+#include "../../registry.h"
/**
* SECTION:sb2_user_interaction_header
@@ -93,6 +94,8 @@ class_init(LassoIdWsf2Sb2UserInteractionHeaderClass *klass)
lasso_node_class_set_nodename(nclass, "UserInteraction");
lasso_node_class_set_ns(nclass, LASSO_IDWSF2_SB2_HREF, LASSO_IDWSF2_SB2_PREFIX);
lasso_node_class_add_snippets(nclass, schema_snippets);
+ lasso_registry_default_add_direct_mapping(LASSO_IDWSF2_SB2_HREF, "UserInteraction", LASSO_LASSO_HREF, "LassoIdWsf2Sb2UserInteractionHeader");
+
}
GType
diff --git a/lasso/xml/id-wsf-2.0/subsref_app_data.c b/lasso/xml/id-wsf-2.0/subsref_app_data.c
index 819b210e..3e8d929b 100644
--- a/lasso/xml/id-wsf-2.0/subsref_app_data.c
+++ b/lasso/xml/id-wsf-2.0/subsref_app_data.c
@@ -24,6 +24,7 @@
#include "../private.h"
#include "subsref_app_data.h"
+#include "../../registry.h"
/**
* SECTION:subsref_app_data
@@ -62,6 +63,7 @@ class_init(LassoIdWsf2SubsRefAppDataClass *klass)
lasso_node_class_set_nodename(nclass, "NewData");
lasso_node_class_set_ns(nclass, LASSO_IDWSF2_SUBSREF_HREF, LASSO_IDWSF2_SUBSREF_PREFIX);
lasso_node_class_add_snippets(nclass, schema_snippets);
+ lasso_registry_default_add_direct_mapping(LASSO_IDWSF2_SUBSREF_HREF, "NewData", LASSO_LASSO_HREF, "LassoIdWsf2SubsRefAppData");
}
GType
diff --git a/lasso/xml/xml.c b/lasso/xml/xml.c
index 743f111a..e9cb0d73 100644
--- a/lasso/xml/xml.c
+++ b/lasso/xml/xml.c
@@ -1545,6 +1545,8 @@ prefix_from_href_and_nodename(const xmlChar *href, const xmlChar *nodename) {
prefix = "Soap";
else if (strcmp((char*)href, LASSO_SOAP_BINDING_HREF) == 0)
prefix = "SoapBinding";
+ else if (strcmp((char*)href, LASSO_SOAP_BINDING_EXT_HREF) == 0)
+ prefix = "SoapBindingExt";
else if (strcmp((char*)href, LASSO_DISCO_HREF) == 0)
prefix = "Disco";
else if (strcmp((char*)href, LASSO_DS_HREF) == 0)
@@ -1567,6 +1569,16 @@ prefix_from_href_and_nodename(const xmlChar *href, const xmlChar *nodename) {
prefix = "IdWsf2Util";
else if (strcmp((char*)href, LASSO_IDWSF2_SEC_HREF) == 0)
prefix = "IdWsf2Sec";
+ else if (strcmp((char*)href, LASSO_IDWSF2_IMS_HREF) == 0)
+ prefix = "IdWsf2Ims";
+ else if (strcmp((char*)href, LASSO_IDWSF2_IS_HREF) == 0)
+ prefix = "IdWsf2Is";
+ else if (strcmp((char*)href, LASSO_IDWSF2_PS_HREF) == 0)
+ prefix = "IdWsf2Ps";
+ else if (strcmp((char*)href, LASSO_IDWSF2_SUBS_HREF) == 0)
+ prefix = "IdWsf2Subs";
+ else if (strcmp((char*)href, LASSO_IDWSF2_SUBSREF_HREF) == 0)
+ prefix = "IdWsf2SubsRef";
else if (strcmp((char*)href, LASSO_WSA_HREF) == 0)
prefix = "WsAddr";
#if 0 /* Desactivate DGME lib special casing */
@@ -1665,16 +1677,17 @@ lasso_node_new_from_xmlNode(xmlNode *xmlnode)
} else if (prefix != NULL && strcmp(prefix, "Soap") == 0 && strcmp(node_name, "detail") == 0) { /* FIXME */
typename = g_strdup("LassoSoapDetail");
} else {
- if (prefix != NULL) {
- typename = g_strdup_printf("Lasso%s%s", prefix, node_name);
- } else {
- if (xmlnode->ns != NULL && xmlnode->ns->href != NULL) {
- const char *ctypename = lasso_registry_default_get_mapping((char*)xmlnode->ns->href, node_name, LASSO_LASSO_HREF);
- if (ctypename) {
- typename = g_strdup(ctypename);
- }
+ /* first try with registered mappings */
+ if (xmlnode->ns != NULL && xmlnode->ns->href != NULL) {
+ const char *ctypename = lasso_registry_default_get_mapping((char*)xmlnode->ns->href, node_name, LASSO_LASSO_HREF);
+ if (ctypename) {
+ typename = g_strdup(ctypename);
}
}
+ /* finally try the default behaviour */
+ if (prefix != NULL && typename == NULL) {
+ typename = g_strdup_printf("Lasso%s%s", prefix, node_name);
+ }
}
}
if (typename) {