rubyjedi-soap4r 1.5.8.01 → 1.5.8.20100616125722
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/wsdl2ruby.rb +1 -0
- data/bin/xsd2ruby.rb +1 -1
- data/lib/soap/baseData.rb +1 -1
- data/lib/soap/element.rb +0 -2
- data/lib/soap/generator.rb +1 -2
- data/lib/soap/mapping/encodedregistry.rb +1 -0
- data/lib/soap/mapping/factory.rb +2 -2
- data/lib/soap/mapping/mapping.rb +3 -4
- data/lib/soap/mapping/registry.rb +0 -15
- data/lib/soap/mapping/rubytypeFactory.rb +0 -1
- data/lib/soap/mapping/wsdlencodedregistry.rb +1 -1
- data/lib/soap/mimemessage.rb +1 -0
- data/lib/soap/nestedexception.rb +1 -1
- data/lib/soap/netHttpClient.rb +4 -4
- data/lib/soap/ns.rb +4 -0
- data/lib/soap/property.rb +21 -15
- data/lib/soap/rpc/element.rb +1 -1
- data/lib/soap/rpc/standaloneServer.rb +1 -1
- data/lib/soap/soap.rb +4 -2
- data/lib/soap/streamHandler.rb +1 -1
- data/lib/soap/version.rb +8 -0
- data/lib/soap/wsdlDriver.rb +2 -2
- data/lib/wsdl/parser.rb +4 -4
- data/lib/wsdl/soap/classDefCreatorSupport.rb +1 -1
- data/lib/wsdl/soap/clientSkeltonCreator.rb +4 -2
- data/lib/wsdl/soap/driverCreator.rb +4 -2
- data/lib/wsdl/soap/methodDefCreator.rb +1 -1
- data/lib/wsdl/soap/servantSkeltonCreator.rb +4 -2
- data/lib/wsdl/soap/wsdl2ruby.rb +1 -1
- data/lib/wsdl/xmlSchema/parser.rb +4 -4
- data/lib/wsdl/xmlSchema/xsd2ruby.rb +1 -1
- data/lib/xsd/charset.rb +4 -3
- data/lib/xsd/codegen/gensupport.rb +8 -5
- data/lib/xsd/datatypes.rb +6 -6
- data/lib/xsd/ns.rb +1 -1
- data/lib/xsd/qname.rb +2 -2
- data/lib/xsd/xmlparser.rb +11 -17
- data/lib/xsd/xmlparser/libxmlparser.rb +6 -10
- data/test/helper.rb +6 -0
- data/test/soap/asp.net/test_aspdotnet.rb +3 -3
- data/test/soap/auth/test_basic.rb +2 -2
- data/test/soap/auth/test_digest.rb +2 -2
- data/test/soap/calc/server.cgi +2 -0
- data/test/soap/calc/test_calc.rb +3 -2
- data/test/soap/calc/test_calc2.rb +3 -2
- data/test/soap/calc/test_calc_cgi.rb +1 -1
- data/test/soap/case/test_mapping.rb +2 -2
- data/test/soap/fault/test_customfault.rb +1 -1
- data/test/soap/fault/test_fault.rb +1 -1
- data/test/soap/fault/test_soaparray.rb +1 -1
- data/test/soap/filter/test_filter.rb +1 -1
- data/test/soap/header/server.cgi +1 -0
- data/test/soap/header/test_authheader.rb +1 -1
- data/test/soap/header/test_authheader_cgi.rb +1 -1
- data/test/soap/header/test_simplehandler.rb +1 -1
- data/test/soap/helloworld/test_helloworld.rb +3 -2
- data/test/soap/literalArrayMapping/test_definedarray.rb +2 -2
- data/test/soap/marshal/marshaltestlib.rb +5 -2
- data/test/soap/marshal/test_digraph.rb +1 -1
- data/test/soap/marshal/test_marshal.rb +3 -2
- data/test/soap/marshal/test_struct.rb +1 -1
- data/test/soap/ssl/sslsvr.rb +1 -0
- data/test/soap/ssl/test_ssl.rb +1 -1
- data/test/soap/struct/test_struct.rb +2 -2
- data/test/soap/swa/test_file.rb +1 -1
- data/test/soap/test_basetype.rb +1 -1
- data/test/soap/test_cookie.rb +2 -2
- data/test/soap/test_custom_ns.rb +4 -4
- data/test/soap/test_custommap.rb +1 -1
- data/test/soap/test_empty.rb +6 -6
- data/test/soap/test_envelopenamespace.rb +2 -2
- data/test/soap/test_extraattr.rb +2 -2
- data/test/soap/test_generator.rb +5 -3
- data/test/soap/test_httpconfigloader.rb +1 -1
- data/test/soap/test_mapping.rb +1 -1
- data/test/soap/test_nestedexception.rb +28 -14
- data/test/soap/test_nil.rb +23 -28
- data/test/soap/test_no_indent.rb +3 -3
- data/test/soap/test_property.rb +2 -2
- data/test/soap/test_response_as_xml.rb +4 -4
- data/test/soap/test_soapelement.rb +1 -1
- data/test/soap/test_streamhandler.rb +2 -2
- data/test/soap/test_styleuse.rb +2 -2
- data/test/soap/wsdlDriver/test_calc.rb +2 -2
- data/test/soap/wsdlDriver/test_document.rb +2 -2
- data/test/soap/wsdlDriver/test_simpletype.rb +3 -2
- data/test/testutil.rb +4 -4
- data/test/wsdl/abstract/test_abstract.rb +2 -2
- data/test/wsdl/anonymous/test_anonymous.rb +2 -2
- data/test/wsdl/any/test_any.rb +2 -2
- data/test/wsdl/axisArray/test_axisarray.rb +2 -2
- data/test/wsdl/choice/test_choice.rb +2 -2
- data/test/wsdl/complexcontent/test_echo.rb +2 -2
- data/test/wsdl/datetime/test_datetime.rb +3 -2
- data/test/wsdl/document/array/test_array.rb +2 -2
- data/test/wsdl/document/test_nosoapaction.rb +2 -2
- data/test/wsdl/document/test_number.rb +2 -2
- data/test/wsdl/document/test_rpc.rb +2 -2
- data/test/wsdl/fault/multifault.wsdl +8 -8
- data/test/wsdl/fault/test_fault.rb +3 -3
- data/test/wsdl/fault/test_multifault.rb +13 -13
- data/test/wsdl/group/test_rpc.rb +2 -2
- data/test/wsdl/list/test_list.rb +2 -2
- data/test/wsdl/map/test_map.rb +1 -1
- data/test/wsdl/marshal/test_wsdlmarshal.rb +3 -4
- data/test/wsdl/oneway/test_oneway.rb +2 -2
- data/test/wsdl/overload/test_overload.rb +2 -2
- data/test/wsdl/qualified/test_qualified.rb +4 -4
- data/test/wsdl/qualified/test_unqualified.rb +4 -4
- data/test/wsdl/raa/test_raa.rb +4 -4
- data/test/wsdl/ref/test_ref.rb +2 -2
- data/test/wsdl/rpc/test_rpc.rb +2 -2
- data/test/wsdl/rpc/test_rpc_lit.rb +18 -18
- data/test/wsdl/simplecontent/test_simplecontent.rb +2 -2
- data/test/wsdl/simpletype/rpc/test_rpc.rb +2 -2
- data/test/wsdl/simpletype/test_simpletype.rb +2 -2
- data/test/wsdl/soap/test_soapbodyparts.rb +1 -1
- data/test/wsdl/soap/wsdl2ruby/section/test_section.rb +2 -2
- data/test/wsdl/soap/wsdl2ruby/soapenc/test_soapenc.rb +2 -2
- data/test/wsdl/soap/wsdl2ruby/test_wsdl2ruby.rb +2 -2
- data/test/wsdl/soaptype/test_soaptype.rb +5 -5
- data/test/wsdl/test_emptycomplextype.rb +1 -1
- data/test/wsdl/test_fault.rb +1 -1
- data/test/wsdl/test_multiplefault.rb +1 -1
- data/test/xsd/codegen/test_classdef.rb +1 -1
- data/test/xsd/test_noencoding.rb +1 -1
- data/test/xsd/test_ns.rb +1 -1
- data/test/xsd/test_xmlschemaparser.rb +1 -1
- data/test/xsd/test_xsd.rb +1 -1
- data/test/xsd/xsd2ruby/test_xsd2ruby.rb +3 -3
- metadata +24 -33
- data/lib/soap/rpc/element.rb.orig +0 -378
- data/lib/soap/ruby18ext.rb +0 -13
- data/lib/xsd/xmlparser.rb.orig +0 -110
- data/test/results +0 -4810
- data/test/soap/header/session.pstoredb +0 -0
- data/test/wsdl/marshal/Person.rb +0 -1
- data/test/wsdl/simpletype/rpc/echo_version.rb +0 -1
- data/test/wsdl/simpletype/rpc/echo_versionDriver.rb +0 -10
- data/test/wsdl/simpletype/rpc/echo_versionMappingRegistry.rb +0 -4
- data/test/wsdl/simpletype/rpc/echo_versionServant.rb +0 -3
- data/test/wsdl/simpletype/rpc/echo_version_service.rb +0 -3
- data/test/wsdl/simpletype/rpc/echo_version_serviceClient.rb +0 -34
- data/test/wsdl/soap/wsdl2ruby/echo_version.rb +0 -1
- data/test/wsdl/soap/wsdl2ruby/echo_versionDriver.rb +0 -10
- data/test/wsdl/soap/wsdl2ruby/echo_versionMappingRegistry.rb +0 -4
- data/test/wsdl/soap/wsdl2ruby/echo_versionServant.rb +0 -3
- data/test/wsdl/soap/wsdl2ruby/echo_version_service.cgi +0 -3
- data/test/wsdl/soap/wsdl2ruby/echo_version_service.rb +0 -7
- data/test/wsdl/soap/wsdl2ruby/echo_version_serviceClient.rb +0 -34
@@ -1,378 +0,0 @@
|
|
1
|
-
# SOAP4R - RPC element definition.
|
2
|
-
# Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
|
3
|
-
|
4
|
-
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
|
5
|
-
# redistribute it and/or modify it under the same terms of Ruby's license;
|
6
|
-
# either the dual license version in 2003, or any later version.
|
7
|
-
|
8
|
-
|
9
|
-
require 'soap/baseData'
|
10
|
-
require 'soap/rpc/methodDef'
|
11
|
-
|
12
|
-
|
13
|
-
module SOAP
|
14
|
-
|
15
|
-
# Add method definitions for RPC to common definition in element.rb
|
16
|
-
class SOAPBody < SOAPStruct
|
17
|
-
public
|
18
|
-
|
19
|
-
def request
|
20
|
-
root_node
|
21
|
-
end
|
22
|
-
|
23
|
-
def response
|
24
|
-
root = root_node
|
25
|
-
if !@is_fault
|
26
|
-
if root.nil?
|
27
|
-
nil
|
28
|
-
elsif root.is_a?(SOAPBasetype)
|
29
|
-
root
|
30
|
-
else
|
31
|
-
# Initial element is [retval].
|
32
|
-
root[0]
|
33
|
-
end
|
34
|
-
else
|
35
|
-
root
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def outparams
|
40
|
-
root = root_node
|
41
|
-
if !@is_fault and !root.nil? and !root.is_a?(SOAPBasetype)
|
42
|
-
op = root[1..-1]
|
43
|
-
op = nil if op && op.empty?
|
44
|
-
op
|
45
|
-
else
|
46
|
-
nil
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def fault
|
51
|
-
if @is_fault
|
52
|
-
self['fault']
|
53
|
-
else
|
54
|
-
nil
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def fault=(fault)
|
59
|
-
@is_fault = true
|
60
|
-
add('fault', fault)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
|
65
|
-
module RPC
|
66
|
-
|
67
|
-
|
68
|
-
class RPCError < Error; end
|
69
|
-
class MethodDefinitionError < RPCError; end
|
70
|
-
class ParameterError < RPCError; end
|
71
|
-
|
72
|
-
class SOAPMethod < SOAPStruct
|
73
|
-
RETVAL = :retval
|
74
|
-
IN = :in
|
75
|
-
OUT = :out
|
76
|
-
INOUT = :inout
|
77
|
-
|
78
|
-
attr_reader :param_def
|
79
|
-
attr_reader :inparam
|
80
|
-
attr_reader :outparam
|
81
|
-
attr_reader :retval_name
|
82
|
-
attr_reader :retval_class_name
|
83
|
-
|
84
|
-
def initialize(qname, param_def = nil)
|
85
|
-
super(nil)
|
86
|
-
@elename = qname
|
87
|
-
@encodingstyle = nil
|
88
|
-
|
89
|
-
@param_def = param_def
|
90
|
-
|
91
|
-
@signature = []
|
92
|
-
@inparam_names = []
|
93
|
-
@inoutparam_names = []
|
94
|
-
@outparam_names = []
|
95
|
-
|
96
|
-
@inparam = {}
|
97
|
-
@outparam = {}
|
98
|
-
@retval_name = nil
|
99
|
-
@retval_class_name = nil
|
100
|
-
|
101
|
-
init_params(@param_def) if @param_def
|
102
|
-
end
|
103
|
-
|
104
|
-
def have_member
|
105
|
-
true
|
106
|
-
end
|
107
|
-
|
108
|
-
def have_outparam?
|
109
|
-
@outparam_names.size > 0
|
110
|
-
end
|
111
|
-
|
112
|
-
def input_params
|
113
|
-
collect_params(IN, INOUT)
|
114
|
-
end
|
115
|
-
|
116
|
-
def output_params
|
117
|
-
collect_params(OUT, INOUT)
|
118
|
-
end
|
119
|
-
|
120
|
-
def input_param_types
|
121
|
-
collect_param_types(IN, INOUT)
|
122
|
-
end
|
123
|
-
|
124
|
-
def output_param_types
|
125
|
-
collect_param_types(OUT, INOUT)
|
126
|
-
end
|
127
|
-
|
128
|
-
def set_param(params)
|
129
|
-
params.each do |param, data|
|
130
|
-
@inparam[param] = data
|
131
|
-
data.elename = XSD::QName.new(data.elename.namespace, param)
|
132
|
-
data.parent = self
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
def set_outparam(params)
|
137
|
-
params.each do |param, data|
|
138
|
-
@outparam[param] = data
|
139
|
-
data.elename = XSD::QName.new(data.elename.namespace, param)
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
def get_paramtypes(names)
|
144
|
-
types = []
|
145
|
-
@signature.each do |io_type, name, type_qname|
|
146
|
-
if type_qname && idx = names.index(name)
|
147
|
-
types[idx] = type_qname
|
148
|
-
end
|
149
|
-
end
|
150
|
-
types
|
151
|
-
end
|
152
|
-
|
153
|
-
def SOAPMethod.param_count(param_def, *type)
|
154
|
-
count = 0
|
155
|
-
param_def.each do |param|
|
156
|
-
param = MethodDef.to_param(param)
|
157
|
-
if type.include?(param.io_type.to_sym)
|
158
|
-
count += 1
|
159
|
-
end
|
160
|
-
end
|
161
|
-
count
|
162
|
-
end
|
163
|
-
|
164
|
-
def SOAPMethod.derive_rpc_param_def(obj, name, *param)
|
165
|
-
if param.size == 1 and param[0].is_a?(Array)
|
166
|
-
return param[0]
|
167
|
-
end
|
168
|
-
if param.empty?
|
169
|
-
method = obj.method(name)
|
170
|
-
param_names = (1..method.arity.abs).collect { |i| "p#{i}" }
|
171
|
-
else
|
172
|
-
param_names = param
|
173
|
-
end
|
174
|
-
create_rpc_param_def(param_names)
|
175
|
-
end
|
176
|
-
|
177
|
-
def SOAPMethod.create_rpc_param_def(param_names)
|
178
|
-
param_def = []
|
179
|
-
param_names.each do |param_name|
|
180
|
-
param_def.push([IN, param_name, nil])
|
181
|
-
end
|
182
|
-
param_def.push([RETVAL, 'return', nil])
|
183
|
-
param_def
|
184
|
-
end
|
185
|
-
|
186
|
-
def SOAPMethod.create_doc_param_def(req_qnames, res_qnames)
|
187
|
-
req_qnames = [req_qnames] if req_qnames.is_a?(XSD::QName)
|
188
|
-
res_qnames = [res_qnames] if res_qnames.is_a?(XSD::QName)
|
189
|
-
param_def = []
|
190
|
-
# req_qnames and res_qnames can be nil
|
191
|
-
if req_qnames
|
192
|
-
req_qnames.each do |qname|
|
193
|
-
param_def << [IN, qname.name, [nil, qname.namespace, qname.name]]
|
194
|
-
end
|
195
|
-
end
|
196
|
-
if res_qnames
|
197
|
-
res_qnames.each do |qname|
|
198
|
-
param_def << [OUT, qname.name, [nil, qname.namespace, qname.name]]
|
199
|
-
end
|
200
|
-
end
|
201
|
-
param_def
|
202
|
-
end
|
203
|
-
|
204
|
-
private
|
205
|
-
|
206
|
-
def collect_param_types(*type)
|
207
|
-
names = []
|
208
|
-
@signature.each do |io_type, name, type_qname|
|
209
|
-
names << type_qname if type.include?(io_type)
|
210
|
-
end
|
211
|
-
names
|
212
|
-
end
|
213
|
-
|
214
|
-
def collect_params(*type)
|
215
|
-
names = []
|
216
|
-
@signature.each do |io_type, name, type_qname|
|
217
|
-
names << name if type.include?(io_type)
|
218
|
-
end
|
219
|
-
names
|
220
|
-
end
|
221
|
-
|
222
|
-
def init_params(param_def)
|
223
|
-
param_def.each do |param|
|
224
|
-
param = MethodDef.to_param(param)
|
225
|
-
init_param(param)
|
226
|
-
end
|
227
|
-
end
|
228
|
-
|
229
|
-
def init_param(param)
|
230
|
-
mapped_class = SOAPMethod.parse_mapped_class(param.mapped_class)
|
231
|
-
qname = param.qname
|
232
|
-
if qname.nil? and mapped_class
|
233
|
-
<<<<<<< HEAD
|
234
|
-
qname = TypeMap.index(mapped_class)
|
235
|
-
=======
|
236
|
-
qname = TypeMap.key(mapped_class)
|
237
|
-
>>>>>>> 0a6c76d203f00369a454de755d1da8830a76210f
|
238
|
-
end
|
239
|
-
case param.io_type
|
240
|
-
when IN
|
241
|
-
@signature.push([IN, param.name, qname])
|
242
|
-
@inparam_names.push(param.name)
|
243
|
-
when OUT
|
244
|
-
@signature.push([OUT, param.name, qname])
|
245
|
-
@outparam_names.push(param.name)
|
246
|
-
when INOUT
|
247
|
-
@signature.push([INOUT, param.name, qname])
|
248
|
-
@inoutparam_names.push(param.name)
|
249
|
-
when RETVAL
|
250
|
-
if @retval_name
|
251
|
-
raise MethodDefinitionError.new('duplicated retval')
|
252
|
-
end
|
253
|
-
@retval_name = param.name
|
254
|
-
@retval_class_name = mapped_class
|
255
|
-
else
|
256
|
-
raise MethodDefinitionError.new("unknown type: #{param.io_type}")
|
257
|
-
end
|
258
|
-
end
|
259
|
-
|
260
|
-
def self.parse_mapped_class(mapped_class)
|
261
|
-
# the first element of typedef in param_def can be a String like
|
262
|
-
# "::SOAP::SOAPStruct" or "CustomClass[]". turn this String to a class if
|
263
|
-
# we can.
|
264
|
-
if mapped_class.is_a?(String)
|
265
|
-
if /\[\]\Z/ =~ mapped_class
|
266
|
-
# when '[]' is added, ignore this.
|
267
|
-
mapped_class = nil
|
268
|
-
else
|
269
|
-
mapped_class = Mapping.class_from_name(mapped_class)
|
270
|
-
end
|
271
|
-
end
|
272
|
-
mapped_class
|
273
|
-
end
|
274
|
-
end
|
275
|
-
|
276
|
-
|
277
|
-
class SOAPMethodRequest < SOAPMethod
|
278
|
-
attr_accessor :soapaction
|
279
|
-
|
280
|
-
def SOAPMethodRequest.create_request(qname, *params)
|
281
|
-
param_def = []
|
282
|
-
param_value = []
|
283
|
-
i = 0
|
284
|
-
params.each do |param|
|
285
|
-
param_name = "p#{i}"
|
286
|
-
i += 1
|
287
|
-
param_def << [IN, param_name, nil]
|
288
|
-
param_value << [param_name, param]
|
289
|
-
end
|
290
|
-
param_def << [RETVAL, 'return', nil]
|
291
|
-
o = new(qname, param_def)
|
292
|
-
o.set_param(param_value)
|
293
|
-
o
|
294
|
-
end
|
295
|
-
|
296
|
-
def initialize(qname, param_def = nil, soapaction = nil)
|
297
|
-
super(qname, param_def)
|
298
|
-
@soapaction = soapaction
|
299
|
-
end
|
300
|
-
|
301
|
-
def each
|
302
|
-
input_params.each do |name|
|
303
|
-
unless @inparam[name]
|
304
|
-
raise ParameterError.new("parameter: #{name} was not given")
|
305
|
-
end
|
306
|
-
yield(name, @inparam[name])
|
307
|
-
end
|
308
|
-
end
|
309
|
-
|
310
|
-
def dup
|
311
|
-
req = self.class.new(@elename.dup, @param_def, @soapaction)
|
312
|
-
req.encodingstyle = @encodingstyle
|
313
|
-
req
|
314
|
-
end
|
315
|
-
|
316
|
-
def create_method_response(response_name = nil)
|
317
|
-
response_name ||=
|
318
|
-
XSD::QName.new(@elename.namespace, @elename.name + 'Response')
|
319
|
-
SOAPMethodResponse.new(response_name, @param_def)
|
320
|
-
end
|
321
|
-
end
|
322
|
-
|
323
|
-
|
324
|
-
class SOAPMethodResponse < SOAPMethod
|
325
|
-
|
326
|
-
def initialize(qname, param_def = nil)
|
327
|
-
super(qname, param_def)
|
328
|
-
@retval = nil
|
329
|
-
end
|
330
|
-
|
331
|
-
def retval
|
332
|
-
@retval
|
333
|
-
end
|
334
|
-
|
335
|
-
def retval=(retval)
|
336
|
-
@retval = retval
|
337
|
-
@retval.elename = @retval.elename.dup_name(@retval_name || 'return')
|
338
|
-
retval.parent = self
|
339
|
-
retval
|
340
|
-
end
|
341
|
-
|
342
|
-
def each
|
343
|
-
if @retval_name and !@retval.is_a?(SOAPVoid)
|
344
|
-
yield(@retval_name, @retval)
|
345
|
-
end
|
346
|
-
|
347
|
-
output_params.each do |name|
|
348
|
-
unless @outparam[name]
|
349
|
-
raise ParameterError.new("parameter: #{name} was not given")
|
350
|
-
end
|
351
|
-
yield(name, @outparam[name])
|
352
|
-
end
|
353
|
-
end
|
354
|
-
end
|
355
|
-
|
356
|
-
|
357
|
-
# To return(?) void explicitly.
|
358
|
-
# def foo(input_var)
|
359
|
-
# ...
|
360
|
-
# return SOAP::RPC::SOAPVoid.new
|
361
|
-
# end
|
362
|
-
class SOAPVoid < XSD::XSDAnySimpleType
|
363
|
-
include SOAPBasetype
|
364
|
-
extend SOAPModuleUtils
|
365
|
-
Name = XSD::QName.new(Mapping::RubyCustomTypeNamespace, nil)
|
366
|
-
|
367
|
-
public
|
368
|
-
def initialize()
|
369
|
-
@elename = Name
|
370
|
-
@id = nil
|
371
|
-
@precedents = []
|
372
|
-
@parent = nil
|
373
|
-
end
|
374
|
-
end
|
375
|
-
|
376
|
-
|
377
|
-
end
|
378
|
-
end
|
data/lib/soap/ruby18ext.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# SOAP4R - Extensions for Ruby 1.8.X compatibility
|
2
|
-
# Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
|
3
|
-
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
|
4
|
-
# redistribute it and/or modify it under the same terms of Ruby's license;
|
5
|
-
# either the dual license version in 2003, or any later version.
|
6
|
-
|
7
|
-
unless RUBY_VERSION >= "1.9.0"
|
8
|
-
class Hash
|
9
|
-
def key(value)
|
10
|
-
index(value)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
data/lib/xsd/xmlparser.rb.orig
DELETED
@@ -1,110 +0,0 @@
|
|
1
|
-
# XSD4R - XML Instance parser library.
|
2
|
-
# Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
|
3
|
-
|
4
|
-
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
|
5
|
-
# redistribute it and/or modify it under the same terms of Ruby's license;
|
6
|
-
# either the dual license version in 2003, or any later version.
|
7
|
-
|
8
|
-
|
9
|
-
require 'xsd/xmlparser/parser'
|
10
|
-
<<<<<<< HEAD
|
11
|
-
=======
|
12
|
-
require 'soap/property'
|
13
|
-
>>>>>>> 0a6c76d203f00369a454de755d1da8830a76210f
|
14
|
-
|
15
|
-
|
16
|
-
module XSD
|
17
|
-
|
18
|
-
|
19
|
-
module XMLParser
|
20
|
-
def create_parser(host, opt)
|
21
|
-
XSD::XMLParser::Parser.create_parser(host, opt)
|
22
|
-
end
|
23
|
-
module_function :create_parser
|
24
|
-
|
25
|
-
# $1 is necessary.
|
26
|
-
<<<<<<< HEAD
|
27
|
-
NSParseRegexp = Regexp.new('^xmlns:?(.*)$', nil, 'NONE')
|
28
|
-
=======
|
29
|
-
NSParseRegexp = Regexp.new("^xmlns:?(.*)$")
|
30
|
-
>>>>>>> 0a6c76d203f00369a454de755d1da8830a76210f
|
31
|
-
|
32
|
-
def filter_ns(ns, attrs)
|
33
|
-
ns_updated = false
|
34
|
-
if attrs.nil? or attrs.empty?
|
35
|
-
return [ns, attrs]
|
36
|
-
end
|
37
|
-
newattrs = {}
|
38
|
-
attrs.each do |key, value|
|
39
|
-
if NSParseRegexp =~ key
|
40
|
-
unless ns_updated
|
41
|
-
ns = ns.clone_ns
|
42
|
-
ns_updated = true
|
43
|
-
end
|
44
|
-
# tag == '' means 'default namespace'
|
45
|
-
# value == '' means 'no default namespace'
|
46
|
-
tag = $1 || ''
|
47
|
-
ns.assign(value, tag)
|
48
|
-
else
|
49
|
-
newattrs[key] = value
|
50
|
-
end
|
51
|
-
end
|
52
|
-
return [ns, newattrs]
|
53
|
-
end
|
54
|
-
module_function :filter_ns
|
55
|
-
end
|
56
|
-
|
57
|
-
|
58
|
-
end
|
59
|
-
|
60
|
-
|
61
|
-
<<<<<<< HEAD
|
62
|
-
# Try to load XML processor.
|
63
|
-
loaded = false
|
64
|
-
[
|
65
|
-
'xsd/xmlparser/libxmlparser',
|
66
|
-
'xsd/xmlparser/xmlparser',
|
67
|
-
'xsd/xmlparser/xmlscanner',
|
68
|
-
'xsd/xmlparser/rexmlparser',
|
69
|
-
].each do |lib|
|
70
|
-
begin
|
71
|
-
require lib
|
72
|
-
# XXX: for a workaround of rubygems' require inconsistency
|
73
|
-
# XXX: MUST BE REMOVED IN THE FUTURE
|
74
|
-
name = lib.sub(/^.*\//, '')
|
75
|
-
raise LoadError unless XSD::XMLParser.constants.find { |c|
|
76
|
-
c.downcase == name
|
77
|
-
=======
|
78
|
-
PARSER_LIBS = [
|
79
|
-
'libxmlparser',
|
80
|
-
'xmlparser',
|
81
|
-
'xmlscanner',
|
82
|
-
'rexmlparser'
|
83
|
-
]
|
84
|
-
# Get library prefs
|
85
|
-
opt = ::SOAP::Property.loadproperty('soap/property')
|
86
|
-
use_libxml = (opt and opt['parser'] and opt['parser']['use_libxml'] and opt['parser']['use_libxml'] == 'false') ? false : true
|
87
|
-
# Try to load XML processor.
|
88
|
-
loaded = false
|
89
|
-
PARSER_LIBS.each do |name|
|
90
|
-
begin
|
91
|
-
lib = "xsd/xmlparser/#{name}"
|
92
|
-
require lib unless !use_libxml && name == 'libxmlparser'
|
93
|
-
# XXX: for a workaround of rubygems' require inconsistency
|
94
|
-
# XXX: MUST BE REMOVED IN THE FUTURE
|
95
|
-
raise LoadError unless XSD::XMLParser.constants.find { |c|
|
96
|
-
c.to_s.downcase == name.downcase
|
97
|
-
>>>>>>> 0a6c76d203f00369a454de755d1da8830a76210f
|
98
|
-
}
|
99
|
-
loaded = true
|
100
|
-
break
|
101
|
-
rescue LoadError
|
102
|
-
end
|
103
|
-
end
|
104
|
-
unless loaded
|
105
|
-
raise RuntimeError.new("XML processor module not found.")
|
106
|
-
end
|
107
|
-
<<<<<<< HEAD
|
108
|
-
=======
|
109
|
-
|
110
|
-
>>>>>>> 0a6c76d203f00369a454de755d1da8830a76210f
|