~ubuntu-branches/ubuntu/jaunty/lasso/jaunty

« back to all changes in this revision

Viewing changes to lasso/xml/soap_fault.c

  • Committer: Bazaar Package Importer
  • Author(s): Loic Pefferkorn
  • Date: 2005-11-25 19:20:59 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051125192059-m4894lhpynmkrmwr
Tags: 0.6.3-4ubuntu1
Resynchronise with Debian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: soap_fault.c,v 1.1 2005/09/27 21:36:26 nclapies Exp $ 
 
2
 *
 
3
 * Lasso - A free implementation of the Liberty Alliance specifications.
 
4
 *
 
5
 * Copyright (C) 2004, 2005 Entr'ouvert
 
6
 * http://lasso.entrouvert.org
 
7
 * 
 
8
 * Authors: See AUTHORS file in top-level directory.
 
9
 *
 
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.
 
14
 * 
 
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.
 
19
 * 
 
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
 
23
 */
 
24
 
 
25
#include <lasso/xml/soap_fault.h>
 
26
 
 
27
/*
 
28
 *
 
29
 * <xs: element name="Fault" type="tns: Fault"/>
 
30
 * <xs: complexType name="Fault" final="extension">
 
31
 *   <xs: annotation>
 
32
 *     <xs: documentation>
 
33
 *       Fault reporting structure
 
34
 *     </xs: documentation>
 
35
 *   </xs: annotation>
 
36
 *   <xs: sequence>
 
37
 *     <xs: element name="faultcode" type="xs: QName"/>
 
38
 *     <xs: element name="faultstring" type="xs: string"/>
 
39
 *     <xs: element name="faultactor" type="xs: anyURI" minOccurs="0"/>
 
40
 *     <xs: element name="detail" type="tns: detail" minOccurs="0"/>
 
41
 *   </xs: sequence>
 
42
 *  </xs: complexType>
 
43
 *
 
44
 *  <xs: complexType name="detail">
 
45
 *    <xs: sequence>
 
46
 *      <xs: any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
 
47
 *    </xs: sequence>
 
48
 *    <xs: anyAttribute namespace="##any" processContents="lax"/>
 
49
 *  </xs: complexType>
 
50
 *
 
51
 */ 
 
52
 
 
53
/*****************************************************************************/
 
54
/* private methods                                                           */
 
55
/*****************************************************************************/
 
56
 
 
57
static struct XmlSnippet schema_snippets[] = {
 
58
        { "faultcode", SNIPPET_CONTENT, G_STRUCT_OFFSET(LassoSoapFault, faultcode) },
 
59
        { "faultstring", SNIPPET_CONTENT, G_STRUCT_OFFSET(LassoSoapFault, faultstring) },
 
60
        { "detail", SNIPPET_LIST_NODES, G_STRUCT_OFFSET(LassoSoapFault, detail) },
 
61
        { NULL, 0, 0}
 
62
};
 
63
 
 
64
/*****************************************************************************/
 
65
/* instance and class init functions                                         */
 
66
/*****************************************************************************/
 
67
 
 
68
static void
 
69
instance_init(LassoSoapFault *node)
 
70
{
 
71
        node->faultcode = NULL;
 
72
        node->faultstring = NULL;
 
73
        node->faultactor = NULL;
 
74
        node->detail = NULL;
 
75
}
 
76
 
 
77
static void
 
78
class_init(LassoSoapFaultClass *klass)
 
79
{
 
80
        LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
 
81
 
 
82
        nclass->node_data = g_new0(LassoNodeClassData, 1);
 
83
        lasso_node_class_set_nodename(nclass, "Fault");
 
84
        lasso_node_class_set_ns(nclass, LASSO_SOAP_ENV_HREF, LASSO_SOAP_ENV_PREFIX);
 
85
        lasso_node_class_add_snippets(nclass, schema_snippets);
 
86
}
 
87
 
 
88
GType
 
89
lasso_soap_fault_get_type()
 
90
{
 
91
        static GType this_type = 0;
 
92
 
 
93
        if (!this_type) {
 
94
                static const GTypeInfo this_info = {
 
95
                        sizeof (LassoSoapFaultClass),
 
96
                        NULL,
 
97
                        NULL,
 
98
                        (GClassInitFunc) class_init,
 
99
                        NULL,
 
100
                        NULL,
 
101
                        sizeof(LassoSoapFault),
 
102
                        0,
 
103
                        (GInstanceInitFunc) instance_init,
 
104
                };
 
105
 
 
106
                this_type = g_type_register_static(LASSO_TYPE_NODE,
 
107
                                "LassoSoapFault", &this_info, 0);
 
108
        }
 
109
        return this_type;
 
110
}
 
111
 
 
112
LassoSoapFault*
 
113
lasso_soap_fault_new()
 
114
{
 
115
        LassoSoapFault *node;
 
116
 
 
117
        node = g_object_new(LASSO_TYPE_SOAP_FAULT, NULL);
 
118
 
 
119
        return node;
 
120
}
 
121
 
 
122
LassoSoapFault*
 
123
lasso_soap_fault_new_from_message(const gchar *message)
 
124
{
 
125
        LassoSoapFault *node;
 
126
 
 
127
        g_return_val_if_fail(message != NULL, NULL);
 
128
 
 
129
        node = g_object_new(LASSO_TYPE_SOAP_FAULT, NULL);
 
130
        lasso_node_init_from_message(LASSO_NODE(node), message);
 
131
 
 
132
        return node;
 
133
}