1
/* $Id: dst_query_response.c,v 1.17 2005/01/22 15:57:55 eraviart Exp $
3
* Lasso - A free implementation of the Liberty Alliance specifications.
5
* Copyright (C) 2004, 2005 Entr'ouvert
6
* http://lasso.entrouvert.org
8
* Authors: See AUTHORS file in top-level directory.
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with this program; if not, write to the Free Software
22
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25
#include <lasso/xml/dst_query_response.h>
28
* Schema fragment (liberty-idwsf-dst-v1.0.xsd):
30
* <xs:element name="QueryResponse" type="QueryResponseType"/>
31
* <xs:complexType name="QueryResponseType">
33
* <xs:element ref="Status"/>
34
* <xs:element name="Data" minOccurs="0" maxOccurs="unbounded"/>
35
* <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
37
* <xs:attribute name="id" type="xs:ID"/>
38
* <xs:attribute name="itemIDRef" type="IDReferenceType"/>
39
* <xs:attribute name="timeStamp" type="xs:dateTime"/>
42
* Schema fragment (liberty-idwsf-utility-1.0-errata-v1.0.xsd):
44
* <xs:simpleType name="IDReferenceType">
46
* <xs:documentation> This type can be used when referring to elements that are
47
* identified using an IDType </xs:documentation>
49
* <xs:restriction base="xs:string"/>
53
/*****************************************************************************/
55
/*****************************************************************************/
57
static struct XmlSnippet schema_snippets[] = {
58
{ "Status", SNIPPET_NODE, G_STRUCT_OFFSET(LassoDstQueryResponse, Status) },
59
{ "Data", SNIPPET_LIST_NODES, G_STRUCT_OFFSET(LassoDstQueryResponse, Data) },
60
{ "Extension", SNIPPET_EXTENSION, G_STRUCT_OFFSET(LassoDstQueryResponse, Extension) },
61
{ "id", SNIPPET_ATTRIBUTE, G_STRUCT_OFFSET(LassoDstQueryResponse, id) },
62
{ "itemIDRef", SNIPPET_ATTRIBUTE,
63
G_STRUCT_OFFSET(LassoDstQueryResponse, itemIDRef) },
64
{ "timeStamp", SNIPPET_ATTRIBUTE,
65
G_STRUCT_OFFSET(LassoDstQueryResponse, timeStamp) },
69
static LassoNodeClass *parent_class = NULL;
72
insure_namespace(xmlNode *xmlnode, xmlNs *ns)
74
xmlNode *t = xmlnode->children;
76
xmlSetNs(xmlnode, ns);
78
if (t->type == XML_ELEMENT_NODE && t->ns == NULL)
79
insure_namespace(t, ns);
85
get_xmlNode(LassoNode *node, gboolean lasso_dump)
90
xmlnode = parent_class->get_xmlNode(node, lasso_dump);
91
ns = xmlNewNs(xmlnode, LASSO_DST_QUERY_RESPONSE(node)->hrefServiceType,
92
LASSO_DST_QUERY_RESPONSE(node)->prefixServiceType);
93
insure_namespace(xmlnode, ns);
98
/*****************************************************************************/
99
/* instance and class init functions */
100
/*****************************************************************************/
103
instance_init(LassoDstQueryResponse *node)
107
node->Extension = NULL;
110
node->itemIDRef = NULL;
111
node->timeStamp = NULL;
113
node->prefixServiceType = NULL;
114
node->hrefServiceType = NULL;
118
class_init(LassoDstQueryResponseClass *klass)
120
LassoNodeClass *nodeClass = LASSO_NODE_CLASS(klass);
122
parent_class = g_type_class_peek_parent(klass);
123
nodeClass->get_xmlNode = get_xmlNode;
124
nodeClass->node_data = g_new0(LassoNodeClassData, 1);
125
lasso_node_class_set_nodename(nodeClass, "QueryResponse");
126
lasso_node_class_add_snippets(nodeClass, schema_snippets);
130
lasso_dst_query_response_get_type()
132
static GType this_type = 0;
135
static const GTypeInfo this_info = {
136
sizeof (LassoDstQueryResponseClass),
139
(GClassInitFunc) class_init,
142
sizeof(LassoDstQueryResponse),
144
(GInstanceInitFunc) instance_init,
147
this_type = g_type_register_static(LASSO_TYPE_NODE,
148
"LassoDstQueryResponse", &this_info, 0);
153
LassoDstQueryResponse*
154
lasso_dst_query_response_new(LassoUtilityStatus *status)
156
LassoDstQueryResponse *node;
158
g_return_val_if_fail(LASSO_IS_UTILITY_STATUS(status), NULL);
160
node = g_object_new(LASSO_TYPE_DST_QUERY_RESPONSE, NULL);
162
node->Status = status;