diff options
Diffstat (limited to 'lasso/xml/dst_query_response.c')
-rw-r--r-- | lasso/xml/dst_query_response.c | 72 |
1 files changed, 28 insertions, 44 deletions
diff --git a/lasso/xml/dst_query_response.c b/lasso/xml/dst_query_response.c index 66b429c1..4d913526 100644 --- a/lasso/xml/dst_query_response.c +++ b/lasso/xml/dst_query_response.c @@ -25,48 +25,38 @@ #include <lasso/xml/dst_query_response.h> +/* +* Schema fragment (liberty-idwsf-dst-v1.0.xsd): +* <xs:element name="QueryResponse" type="QueryResponseType"/> +* <xs:complexType name="QueryResponseType"> +* <xs:sequence> +* <xs:element ref="Status"/> +* <xs:element name="Data" minOccurs="0" maxOccurs="unbounded"/> +* <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/> +* </xs:sequence> +* <xs:attribute name="id" type="xs:ID"/> +* <xs:attribute name="itemIDRef" type="IDReferenceType"/> +* <xs:attribute name="timeStamp" type="xs:dateTime"/> +* </xs:complexType> +*/ /*****************************************************************************/ /* private methods */ /*****************************************************************************/ -#define snippets() \ - LassoDstQueryResponse *query_response = LASSO_DST_QUERY_RESPONSE(node); \ - struct XmlSnippetObsolete snippets[] = { \ - { "Status", SNIPPET_NODE, (void**)&(query_response->Status) }, \ - { NULL, 0, NULL } \ - }; +static struct XmlSnippet schema_snippets[] = { + { "Status", SNIPPET_NODE, G_STRUCT_OFFSET(LassoDstQueryResponse, Status) }, + { "Data", SNIPPET_LIST_NODES, G_STRUCT_OFFSET(LassoDstQueryResponse, Data) }, + { "id", SNIPPET_ATTRIBUTE, G_STRUCT_OFFSET(LassoDstQueryResponse, id) }, + { "itemIDRef", SNIPPET_ATTRIBUTE, \ + G_STRUCT_OFFSET(LassoDstQueryResponse, itemIDRef) }, + { "timeStamp", SNIPPET_ATTRIBUTE, \ + G_STRUCT_OFFSET(LassoDstQueryResponse, timeStamp) }, + {NULL, 0, 0} +}; static LassoNodeClass *parent_class = NULL; -static xmlNode* -get_xmlNode(LassoNode *node) -{ - xmlNode *xmlnode; - snippets(); - - xmlnode = xmlNewNode(NULL, "QueryResponse"); - xmlSetNs(xmlnode, xmlNewNs(xmlnode, NULL, NULL)); - - build_xml_with_snippets(xmlnode, snippets); - - return xmlnode; -} - -static int -init_from_xml(LassoNode *node, xmlNode *xmlnode) -{ - snippets(); - - if (parent_class->init_from_xml(node, xmlnode)) - return -1; - - init_xml_with_snippets(xmlnode, snippets); - - return 0; -} - - /*****************************************************************************/ /* instance and class init functions */ /*****************************************************************************/ @@ -89,8 +79,9 @@ class_init(LassoDstQueryResponseClass *klass) LassoNodeClass *nodeClass = LASSO_NODE_CLASS(klass); parent_class = g_type_class_peek_parent(klass); - nodeClass->get_xmlNode = get_xmlNode; - nodeClass->init_from_xml = init_from_xml; + nodeClass->node_data = g_new0(LassoNodeClassData, 1); + lasso_node_class_set_nodename(nodeClass, "QueryResponse"); + lasso_node_class_add_snippets(nodeClass, schema_snippets); } GType @@ -118,10 +109,7 @@ lasso_dst_query_response_get_type() } LassoDstQueryResponse* -lasso_dst_query_response_new(LassoUtilityStatus *Status, - const char *id, - const char *itemIDRef, - const char *timeStamp) +lasso_dst_query_response_new(LassoUtilityStatus *Status) { LassoDstQueryResponse *node; @@ -129,10 +117,6 @@ lasso_dst_query_response_new(LassoUtilityStatus *Status, node->Status = Status; - node->id = g_strdup(id); - node->itemIDRef = g_strdup(itemIDRef); - node->timeStamp = g_strdup(timeStamp); - return node; } |