2
# This file is part of GNU Enterprise.
4
# GNU Enterprise is free software; you can redistribute it
5
# and/or modify it under the terms of the GNU General Public
6
# License as published by the Free Software Foundation; either
7
# version 2, or (at your option) any later version.
9
# GNU Enterprise is distributed in the hope that it will be
10
# useful, but WITHOUT ANY WARRANTY; without even the implied
11
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12
# PURPOSE. See the GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public
15
# License along with program; see the file COPYING. If not,
16
# write to the Free Software Foundation, Inc., 59 Temple Place
17
# - Suite 330, Boston, MA 02111-1307, USA.
19
# Copyright 2001-2005 Free Software Foundation
25
# Class that implements the GParser XML parser framework for GNUe RPC.
31
from gnue.common.definitions import GParser
34
from gnue.common.formatting import GTypecast
42
######## Please keep this file neat !!!
50
#######################################################
51
# This method loads a form from an XML file and returns
52
# a GFForm object. If initialize is 1 (default), then
53
# the form is initialized and ready to go.
55
# (initialize=0 is currently not used -- will probably
56
# be used in the Forms Designer package where we will
57
# not want the loaded form to connect to databases, etc)
58
#######################################################
60
def loadDefinition(URL, initialize=0):
61
return GParser.loadXMLObject (URL, xmlHandler, "RpGnuRpc", 'gnurpc',
62
initialize, attributes={})
72
if xmlElements == None:
77
'BaseClass': Objects.GnuRpc,
79
# 'SingleInstance': 1,
83
'BaseClass': Objects.RpcService,
87
'Typecast': GTypecast.name,
90
'Typecast': GTypecast.name },
92
'Typecast': GTypecast.name } },
93
'ParentTags': ('gnurpc','service') },
96
'BaseClass': Objects.RpcMethod,
98
# 'SingleInstance': 1,
101
'Typecast': GTypecast.name,
104
'Typecast': GTypecast.name },
106
'Typecast': GTypecast.name } },
107
'ParentTags': ('gnurpc','service','object') },
110
'BaseClass': Objects.RpcObject,
111
# 'SingleInstance': 1,
114
'Typecast': GTypecast.name,
117
'Typecast': GTypecast.name }},
118
'ParentTags': ('gnurpc','service') },
121
'BaseClass': Objects.RpcArgument,
124
'Typecast': GTypecast.name,
127
'Typecast': GTypecast.name,
130
'Typecast': GTypecast.text },
132
'Typecast': GTypecast.name } },
133
'ParentTags': ('method',) },
136
'BaseClass': Objects.RpcAttribute,
139
'Typecast': GTypecast.name,
142
'Typecast': GTypecast.name,
145
'Typecast': GTypecast.boolean,
148
'Typecast': GTypecast.boolean,
151
'Typecast': GTypecast.name } },
152
'ParentTags': ('object',) },
155
'BaseClass': Objects.RpcException,
158
'Typecast': GTypecast.name,
161
'Typecast': GTypecast.name } },
162
'ParentTags': ('gnurpc','service') },
165
'BaseClass': Objects.RpcRaises,
168
'References': (('exception','name'),),
169
'Typecast': GTypecast.name,
171
'ParentTags': ('gnurpc','service') },
178
#######################################################
182
# This class is called by the XML parser to
183
# process the xml file.
185
#######################################################
187
class xmlHandler (GParser.xmlHandler):
190
GParser.xmlHandler.__init__(self)
192
self.xmlElements = getXMLelements()