diff options
Diffstat (limited to 'lasso/xml/id-wsf-2.0/disco_query_response.c')
-rw-r--r-- | lasso/xml/id-wsf-2.0/disco_query_response.c | 113 |
1 files changed, 36 insertions, 77 deletions
diff --git a/lasso/xml/id-wsf-2.0/disco_query_response.c b/lasso/xml/id-wsf-2.0/disco_query_response.c index 7bda0c3e..49d4e2d8 100644 --- a/lasso/xml/id-wsf-2.0/disco_query_response.c +++ b/lasso/xml/id-wsf-2.0/disco_query_response.c @@ -1,8 +1,8 @@ -/* $Id: disco_query_response.c,v 1.9 2005/08/12 09:08:44$ +/* $Id: disco_query_response.c,v 1.0 2005/10/14 15:17:55 fpeters Exp $ * * Lasso - A free implementation of the Liberty Alliance specifications. * - * Copyright (C) 2007 Entr'ouvert + * Copyright (C) 2004-2007 Entr'ouvert * http://lasso.entrouvert.org * * Authors: See AUTHORS file in top-level directory. @@ -22,67 +22,42 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <lasso/xml/id-wsf-2.0/disco_query_response.h> +#include "disco_query_response.h" /* * Schema fragment (liberty-idwsf-disco-svc-v2.0.xsd): * - * <xs:element name="QueryResponse" type="QueryResponseType"/> - * * <xs:complexType name="QueryResponseType"> * <xs:sequence> * <xs:element ref="lu:Status"/> - * <xs:element ref="wsa:EndpointReference" - * minOccurs="0" - * maxOccurs="unbounded"/> - * </xs:sequence> - * <xs:anyAttribute namespace="##other" processContents="lax"/> - * </xs:complexType> + * + * <xs:element ref="wsa:EndpointReference" + * minOccurs="0" + * maxOccurs="unbounded"/> + * </xs:sequence> + * <xs:anyAttribute namespace="##other" processContents="lax"/> + * </xs:complexType> */ /*****************************************************************************/ /* private methods */ /*****************************************************************************/ + static struct XmlSnippet schema_snippets[] = { -// { "Status", SNIPPET_NODE, -// G_STRUCT_OFFSET(LassoIdWsf2DiscoQueryResponse, Status) }, -// { "ResourceOffering", SNIPPET_LIST_NODES, -// G_STRUCT_OFFSET(LassoIdWsf2DiscoQueryResponse, ResourceOffering) }, -// { "Credentials", SNIPPET_NODE, -// G_STRUCT_OFFSET(LassoIdWsf2DiscoQueryResponse, Credentials) }, - { "id", SNIPPET_ATTRIBUTE, - G_STRUCT_OFFSET(LassoIdWsf2DiscoQueryResponse, id) }, - { NULL, 0, 0} + { "Status", SNIPPET_NODE, + G_STRUCT_OFFSET(LassoIdWsf2DiscoQueryResponse, Status), + "LassoIdWsf2UtilStatus" }, + { "EndpointReference", SNIPPET_LIST_NODES, + G_STRUCT_OFFSET(LassoIdWsf2DiscoQueryResponse, EndpointReference), + "LassoWsAddrEndpointReference" }, + { "any", SNIPPET_ATTRIBUTE | SNIPPET_ANY, + G_STRUCT_OFFSET(LassoIdWsf2DiscoQueryResponse, attributes) }, + {NULL, 0, 0} }; static LassoNodeClass *parent_class = NULL; -static void -insure_namespace(xmlNode *xmlnode, xmlNs *ns) -{ - xmlNode *t = xmlnode->children; - - xmlSetNs(xmlnode, ns); - while (t) { - if (t->type == XML_ELEMENT_NODE && t->ns == NULL) - insure_namespace(t, ns); - t = t->next; - } -} - -static xmlNode* -get_xmlNode(LassoNode *node, gboolean lasso_dump) -{ - xmlNode *xmlnode; - xmlNs *ns; - - xmlnode = parent_class->get_xmlNode(node, lasso_dump); - ns = xmlNewNs(NULL, (xmlChar*)LASSO_IDWSF2_DISCO_HREF, (xmlChar*)LASSO_IDWSF2_DISCO_PREFIX); - insure_namespace(xmlnode, ns); - - return xmlnode; -} /*****************************************************************************/ /* instance and class init functions */ @@ -92,19 +67,17 @@ static void instance_init(LassoIdWsf2DiscoQueryResponse *node) { node->Status = NULL; -// node->ResourceOffering = NULL; -// node->Credentials = NULL; - - node->id = NULL; + node->EndpointReference = NULL; + node->attributes = g_hash_table_new_full( + g_str_hash, g_str_equal, g_free, g_free); } static void -class_init(LassoIdWsf2DiscoQueryResponseClass *class) +class_init(LassoIdWsf2DiscoQueryResponseClass *klass) { - LassoNodeClass *nclass = LASSO_NODE_CLASS(class); + LassoNodeClass *nclass = LASSO_NODE_CLASS(klass); - parent_class = g_type_class_peek_parent(class); - nclass->get_xmlNode = get_xmlNode; + parent_class = g_type_class_peek_parent(klass); nclass->node_data = g_new0(LassoNodeClassData, 1); lasso_node_class_set_nodename(nclass, "QueryResponse"); lasso_node_class_set_ns(nclass, LASSO_IDWSF2_DISCO_HREF, LASSO_IDWSF2_DISCO_PREFIX); @@ -135,29 +108,15 @@ lasso_idwsf2_disco_query_response_get_type() return this_type; } -LassoIdWsf2DiscoQueryResponse* -lasso_idwsf2_disco_query_response_new(LassoUtilityStatus *status) -{ - LassoIdWsf2DiscoQueryResponse *node; - - g_return_val_if_fail(LASSO_IS_UTILITY_STATUS(status), NULL); - - node = g_object_new(LASSO_TYPE_IDWSF2_DISCO_QUERY_RESPONSE, NULL); - - node->Status = status; - - return node; -} - -LassoIdWsf2DiscoQueryResponse* -lasso_idwsf2_disco_query_response_new_from_message(const gchar *message) +/** + * lasso_idwsf2_disco_query_response_new: + * + * Creates a new #LassoIdWsf2DiscoQueryResponse object. + * + * Return value: a newly created #LassoIdWsf2DiscoQueryResponse object + **/ +LassoNode* +lasso_idwsf2_disco_query_response_new() { - LassoIdWsf2DiscoQueryResponse *response; - - g_return_val_if_fail(message != NULL, NULL); - - response = g_object_new(LASSO_TYPE_IDWSF2_DISCO_QUERY_RESPONSE, NULL); - lasso_node_init_from_message(LASSO_NODE(response), message); - - return response; + return g_object_new(LASSO_TYPE_IDWSF2_DISCO_QUERY_RESPONSE, NULL); } |