yieldmanager 0.9.5 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby-version +1 -0
- data/README.md +1 -1
- data/lib/soap4r_19_patch/soap/baseData.rb +1092 -0
- data/lib/soap4r_19_patch/xsd/charset.rb +5 -5
- data/lib/soap4r_19_patch/xsd/ns.rb +182 -0
- data/lib/soap4r_19_patch/xsd/xmlparser.rb +1 -1
- data/lib/yieldmanager/version.rb +1 -1
- metadata +7 -5
- data/.rvmrc +0 -1
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3-p362
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ copies) and re-uses that wsdl for the life of the Yieldmanager::Client object.
|
|
9
9
|
|
10
10
|
The current API version is stored in the API_VERSION file.
|
11
11
|
|
12
|
-
The gem should run properly on 1.8, 1.9 and
|
12
|
+
The gem should run properly on 1.8, 1.9, 2.0 and JRuby 1.7.4, but 1.8 support will likely be removed in a future version.
|
13
13
|
|
14
14
|
### Installation
|
15
15
|
|
@@ -0,0 +1,1092 @@
|
|
1
|
+
# soap/baseData.rb: SOAP4R - Base type 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/datatypes'
|
10
|
+
require 'soap/soap'
|
11
|
+
require 'xsd/codegen/gensupport'
|
12
|
+
require 'soap/mapping/mapping'
|
13
|
+
|
14
|
+
|
15
|
+
module SOAP
|
16
|
+
|
17
|
+
|
18
|
+
###
|
19
|
+
## Mix-in module for SOAP base type classes.
|
20
|
+
#
|
21
|
+
module SOAPModuleUtils
|
22
|
+
include SOAP
|
23
|
+
|
24
|
+
public
|
25
|
+
|
26
|
+
def decode(elename)
|
27
|
+
d = self.new
|
28
|
+
d.elename = elename
|
29
|
+
d
|
30
|
+
end
|
31
|
+
|
32
|
+
def to_data(str)
|
33
|
+
new(str).data
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
###
|
39
|
+
## for SOAP type(base and compound)
|
40
|
+
#
|
41
|
+
module SOAPType
|
42
|
+
attr_accessor :encodingstyle
|
43
|
+
attr_accessor :elename
|
44
|
+
attr_accessor :id
|
45
|
+
attr_reader :precedents
|
46
|
+
attr_accessor :root
|
47
|
+
attr_accessor :parent
|
48
|
+
attr_accessor :position
|
49
|
+
attr_reader :extraattr
|
50
|
+
attr_accessor :definedtype
|
51
|
+
|
52
|
+
def initialize(*arg)
|
53
|
+
super
|
54
|
+
@encodingstyle = nil
|
55
|
+
@elename = XSD::QName::EMPTY
|
56
|
+
@id = nil
|
57
|
+
@precedents = []
|
58
|
+
@root = false
|
59
|
+
@parent = nil
|
60
|
+
@position = nil
|
61
|
+
@definedtype = nil
|
62
|
+
@extraattr = {}
|
63
|
+
end
|
64
|
+
|
65
|
+
def inspect
|
66
|
+
if self.is_a?(XSD::NSDBase)
|
67
|
+
sprintf("#<%s:0x%x %s %s>", self.class.name, __id__, self.elename, self.type)
|
68
|
+
else
|
69
|
+
sprintf("#<%s:0x%x %s>", self.class.name, __id__, self.elename)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def rootnode
|
74
|
+
node = self
|
75
|
+
while node = node.parent
|
76
|
+
break if SOAPEnvelope === node
|
77
|
+
end
|
78
|
+
node
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
|
83
|
+
###
|
84
|
+
## for SOAP base type
|
85
|
+
#
|
86
|
+
module SOAPBasetype
|
87
|
+
include SOAPType
|
88
|
+
include SOAP
|
89
|
+
|
90
|
+
attr_accessor :qualified
|
91
|
+
|
92
|
+
def initialize(*arg)
|
93
|
+
super
|
94
|
+
@qualified = nil
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
|
99
|
+
###
|
100
|
+
## for SOAP compound type
|
101
|
+
#
|
102
|
+
module SOAPCompoundtype
|
103
|
+
include SOAPType
|
104
|
+
include SOAP
|
105
|
+
|
106
|
+
attr_accessor :qualified
|
107
|
+
|
108
|
+
def initialize(*arg)
|
109
|
+
super
|
110
|
+
@qualified = nil
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
# marker for compound types which have named accessor
|
115
|
+
module SOAPNameAccessible
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
###
|
120
|
+
## Convenience datatypes.
|
121
|
+
#
|
122
|
+
class SOAPReference < XSD::NSDBase
|
123
|
+
include SOAPBasetype
|
124
|
+
extend SOAPModuleUtils
|
125
|
+
|
126
|
+
public
|
127
|
+
|
128
|
+
attr_accessor :refid
|
129
|
+
|
130
|
+
# Override the definition in SOAPBasetype.
|
131
|
+
def initialize(obj = nil)
|
132
|
+
super()
|
133
|
+
@type = XSD::QName::EMPTY
|
134
|
+
@refid = nil
|
135
|
+
@obj = nil
|
136
|
+
__setobj__(obj) if obj
|
137
|
+
end
|
138
|
+
|
139
|
+
def __getobj__
|
140
|
+
@obj
|
141
|
+
end
|
142
|
+
|
143
|
+
def __setobj__(obj)
|
144
|
+
@obj = obj
|
145
|
+
@refid = @obj.id || SOAPReference.create_refid(@obj)
|
146
|
+
@obj.id = @refid unless @obj.id
|
147
|
+
@obj.precedents << self
|
148
|
+
# Copies NSDBase information
|
149
|
+
@obj.type = @type unless @obj.type
|
150
|
+
end
|
151
|
+
|
152
|
+
# Why don't I use delegate.rb?
|
153
|
+
# -> delegate requires target object type at initialize time.
|
154
|
+
# Why don't I use forwardable.rb?
|
155
|
+
# -> forwardable requires a list of forwarding methods.
|
156
|
+
#
|
157
|
+
# ToDo: Maybe I should use forwardable.rb and give it a methods list like
|
158
|
+
# delegate.rb...
|
159
|
+
#
|
160
|
+
def method_missing(msg_id, *params)
|
161
|
+
if @obj
|
162
|
+
@obj.send(msg_id, *params)
|
163
|
+
else
|
164
|
+
nil
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
# for referenced base type such as a long value from Axis.
|
169
|
+
# base2obj requires a node to respond to :data
|
170
|
+
def data
|
171
|
+
if @obj.respond_to?(:data)
|
172
|
+
@obj.data
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
def refidstr
|
177
|
+
'#' + @refid
|
178
|
+
end
|
179
|
+
|
180
|
+
def self.create_refid(obj)
|
181
|
+
'id' + obj.__id__.to_s
|
182
|
+
end
|
183
|
+
|
184
|
+
def self.decode(elename, refidstr)
|
185
|
+
if /\A#(.*)\z/ =~ refidstr
|
186
|
+
refid = $1
|
187
|
+
elsif /\Acid:(.*)\z/ =~ refidstr
|
188
|
+
refid = $1
|
189
|
+
else
|
190
|
+
raise ArgumentError.new("illegal refid #{refidstr}")
|
191
|
+
end
|
192
|
+
d = super(elename)
|
193
|
+
d.refid = refid
|
194
|
+
d
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
|
199
|
+
class SOAPExternalReference < XSD::NSDBase
|
200
|
+
include SOAPBasetype
|
201
|
+
extend SOAPModuleUtils
|
202
|
+
|
203
|
+
def initialize
|
204
|
+
super()
|
205
|
+
@type = XSD::QName::EMPTY
|
206
|
+
end
|
207
|
+
|
208
|
+
def referred
|
209
|
+
rootnode.external_content[external_contentid] = self
|
210
|
+
end
|
211
|
+
|
212
|
+
def refidstr
|
213
|
+
'cid:' + external_contentid
|
214
|
+
end
|
215
|
+
|
216
|
+
private
|
217
|
+
|
218
|
+
def external_contentid
|
219
|
+
raise NotImplementedError.new
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
|
224
|
+
class SOAPNil < XSD::XSDNil
|
225
|
+
include SOAPBasetype
|
226
|
+
extend SOAPModuleUtils
|
227
|
+
|
228
|
+
public
|
229
|
+
|
230
|
+
def initialize(value = nil)
|
231
|
+
super(value)
|
232
|
+
@extraattr[XSD::AttrNilName] = 'true'
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
# SOAPRawString is for sending raw string. In contrast to SOAPString,
|
237
|
+
# SOAP4R does not do XML encoding and does not convert its CES. The string it
|
238
|
+
# holds is embedded to XML instance directly as a 'xsd:string'.
|
239
|
+
class SOAPRawString < XSD::XSDString
|
240
|
+
include SOAPBasetype
|
241
|
+
extend SOAPModuleUtils
|
242
|
+
end
|
243
|
+
|
244
|
+
|
245
|
+
###
|
246
|
+
## Basic datatypes.
|
247
|
+
#
|
248
|
+
class SOAPAnySimpleType < XSD::XSDAnySimpleType
|
249
|
+
include SOAPBasetype
|
250
|
+
extend SOAPModuleUtils
|
251
|
+
end
|
252
|
+
|
253
|
+
class SOAPString < XSD::XSDString
|
254
|
+
include SOAPBasetype
|
255
|
+
extend SOAPModuleUtils
|
256
|
+
SOAPENCType = QName.new(EncodingNamespace, StringLiteral)
|
257
|
+
end
|
258
|
+
|
259
|
+
class SOAPNormalizedString < XSD::XSDNormalizedString
|
260
|
+
include SOAPBasetype
|
261
|
+
extend SOAPModuleUtils
|
262
|
+
SOAPENCType = QName.new(EncodingNamespace, NormalizedStringLiteral)
|
263
|
+
end
|
264
|
+
|
265
|
+
class SOAPToken < XSD::XSDToken
|
266
|
+
include SOAPBasetype
|
267
|
+
extend SOAPModuleUtils
|
268
|
+
SOAPENCType = QName.new(EncodingNamespace, TokenLiteral)
|
269
|
+
end
|
270
|
+
|
271
|
+
class SOAPLanguage < XSD::XSDLanguage
|
272
|
+
include SOAPBasetype
|
273
|
+
extend SOAPModuleUtils
|
274
|
+
SOAPENCType = QName.new(EncodingNamespace, LanguageLiteral)
|
275
|
+
end
|
276
|
+
|
277
|
+
class SOAPNMTOKEN < XSD::XSDNMTOKEN
|
278
|
+
include SOAPBasetype
|
279
|
+
extend SOAPModuleUtils
|
280
|
+
SOAPENCType = QName.new(EncodingNamespace, NMTOKENLiteral)
|
281
|
+
end
|
282
|
+
|
283
|
+
class SOAPNMTOKENS < XSD::XSDNMTOKENS
|
284
|
+
include SOAPBasetype
|
285
|
+
extend SOAPModuleUtils
|
286
|
+
SOAPENCType = QName.new(EncodingNamespace, NMTOKENSLiteral)
|
287
|
+
end
|
288
|
+
|
289
|
+
class SOAPName < XSD::XSDName
|
290
|
+
include SOAPBasetype
|
291
|
+
extend SOAPModuleUtils
|
292
|
+
SOAPENCType = QName.new(EncodingNamespace, NameLiteral)
|
293
|
+
end
|
294
|
+
|
295
|
+
class SOAPNCName < XSD::XSDNCName
|
296
|
+
include SOAPBasetype
|
297
|
+
extend SOAPModuleUtils
|
298
|
+
SOAPENCType = QName.new(EncodingNamespace, NCNameLiteral)
|
299
|
+
end
|
300
|
+
|
301
|
+
class SOAPID < XSD::XSDID
|
302
|
+
include SOAPBasetype
|
303
|
+
extend SOAPModuleUtils
|
304
|
+
SOAPENCType = QName.new(EncodingNamespace, IDLiteral)
|
305
|
+
end
|
306
|
+
|
307
|
+
class SOAPIDREF < XSD::XSDIDREF
|
308
|
+
include SOAPBasetype
|
309
|
+
extend SOAPModuleUtils
|
310
|
+
SOAPENCType = QName.new(EncodingNamespace, IDREFLiteral)
|
311
|
+
end
|
312
|
+
|
313
|
+
class SOAPIDREFS < XSD::XSDIDREFS
|
314
|
+
include SOAPBasetype
|
315
|
+
extend SOAPModuleUtils
|
316
|
+
SOAPENCType = QName.new(EncodingNamespace, IDREFSLiteral)
|
317
|
+
end
|
318
|
+
|
319
|
+
class SOAPENTITY < XSD::XSDENTITY
|
320
|
+
include SOAPBasetype
|
321
|
+
extend SOAPModuleUtils
|
322
|
+
SOAPENCType = QName.new(EncodingNamespace, ENTITYLiteral)
|
323
|
+
end
|
324
|
+
|
325
|
+
class SOAPENTITIES < XSD::XSDENTITIES
|
326
|
+
include SOAPBasetype
|
327
|
+
extend SOAPModuleUtils
|
328
|
+
SOAPENCType = QName.new(EncodingNamespace, ENTITIESLiteral)
|
329
|
+
end
|
330
|
+
|
331
|
+
class SOAPBoolean < XSD::XSDBoolean
|
332
|
+
include SOAPBasetype
|
333
|
+
extend SOAPModuleUtils
|
334
|
+
SOAPENCType = QName.new(EncodingNamespace, BooleanLiteral)
|
335
|
+
end
|
336
|
+
|
337
|
+
class SOAPDecimal < XSD::XSDDecimal
|
338
|
+
include SOAPBasetype
|
339
|
+
extend SOAPModuleUtils
|
340
|
+
SOAPENCType = QName.new(EncodingNamespace, DecimalLiteral)
|
341
|
+
end
|
342
|
+
|
343
|
+
class SOAPFloat < XSD::XSDFloat
|
344
|
+
include SOAPBasetype
|
345
|
+
extend SOAPModuleUtils
|
346
|
+
SOAPENCType = QName.new(EncodingNamespace, FloatLiteral)
|
347
|
+
end
|
348
|
+
|
349
|
+
class SOAPDouble < XSD::XSDDouble
|
350
|
+
include SOAPBasetype
|
351
|
+
extend SOAPModuleUtils
|
352
|
+
SOAPENCType = QName.new(EncodingNamespace, DoubleLiteral)
|
353
|
+
end
|
354
|
+
|
355
|
+
class SOAPDuration < XSD::XSDDuration
|
356
|
+
include SOAPBasetype
|
357
|
+
extend SOAPModuleUtils
|
358
|
+
SOAPENCType = QName.new(EncodingNamespace, DurationLiteral)
|
359
|
+
end
|
360
|
+
|
361
|
+
class SOAPDateTime < XSD::XSDDateTime
|
362
|
+
include SOAPBasetype
|
363
|
+
extend SOAPModuleUtils
|
364
|
+
SOAPENCType = QName.new(EncodingNamespace, DateTimeLiteral)
|
365
|
+
end
|
366
|
+
|
367
|
+
class SOAPTime < XSD::XSDTime
|
368
|
+
include SOAPBasetype
|
369
|
+
extend SOAPModuleUtils
|
370
|
+
SOAPENCType = QName.new(EncodingNamespace, TimeLiteral)
|
371
|
+
end
|
372
|
+
|
373
|
+
class SOAPDate < XSD::XSDDate
|
374
|
+
include SOAPBasetype
|
375
|
+
extend SOAPModuleUtils
|
376
|
+
SOAPENCType = QName.new(EncodingNamespace, DateLiteral)
|
377
|
+
end
|
378
|
+
|
379
|
+
class SOAPGYearMonth < XSD::XSDGYearMonth
|
380
|
+
include SOAPBasetype
|
381
|
+
extend SOAPModuleUtils
|
382
|
+
SOAPENCType = QName.new(EncodingNamespace, GYearMonthLiteral)
|
383
|
+
end
|
384
|
+
|
385
|
+
class SOAPGYear < XSD::XSDGYear
|
386
|
+
include SOAPBasetype
|
387
|
+
extend SOAPModuleUtils
|
388
|
+
SOAPENCType = QName.new(EncodingNamespace, GYearLiteral)
|
389
|
+
end
|
390
|
+
|
391
|
+
class SOAPGMonthDay < XSD::XSDGMonthDay
|
392
|
+
include SOAPBasetype
|
393
|
+
extend SOAPModuleUtils
|
394
|
+
SOAPENCType = QName.new(EncodingNamespace, GMonthDayLiteral)
|
395
|
+
end
|
396
|
+
|
397
|
+
class SOAPGDay < XSD::XSDGDay
|
398
|
+
include SOAPBasetype
|
399
|
+
extend SOAPModuleUtils
|
400
|
+
SOAPENCType = QName.new(EncodingNamespace, GDayLiteral)
|
401
|
+
end
|
402
|
+
|
403
|
+
class SOAPGMonth < XSD::XSDGMonth
|
404
|
+
include SOAPBasetype
|
405
|
+
extend SOAPModuleUtils
|
406
|
+
SOAPENCType = QName.new(EncodingNamespace, GMonthLiteral)
|
407
|
+
end
|
408
|
+
|
409
|
+
class SOAPHexBinary < XSD::XSDHexBinary
|
410
|
+
include SOAPBasetype
|
411
|
+
extend SOAPModuleUtils
|
412
|
+
SOAPENCType = QName.new(EncodingNamespace, HexBinaryLiteral)
|
413
|
+
end
|
414
|
+
|
415
|
+
class SOAPBase64 < XSD::XSDBase64Binary
|
416
|
+
include SOAPBasetype
|
417
|
+
extend SOAPModuleUtils
|
418
|
+
Type = SOAPENCType = QName.new(EncodingNamespace, Base64Literal)
|
419
|
+
|
420
|
+
public
|
421
|
+
|
422
|
+
def initialize(value = nil)
|
423
|
+
super(value)
|
424
|
+
@type = Type
|
425
|
+
end
|
426
|
+
|
427
|
+
def as_xsd
|
428
|
+
@type = XSD::XSDBase64Binary::Type
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
432
|
+
class SOAPAnyURI < XSD::XSDAnyURI
|
433
|
+
include SOAPBasetype
|
434
|
+
extend SOAPModuleUtils
|
435
|
+
SOAPENCType = QName.new(EncodingNamespace, AnyURILiteral)
|
436
|
+
end
|
437
|
+
|
438
|
+
class SOAPQName < XSD::XSDQName
|
439
|
+
include SOAPBasetype
|
440
|
+
extend SOAPModuleUtils
|
441
|
+
SOAPENCType = QName.new(EncodingNamespace, QNameLiteral)
|
442
|
+
end
|
443
|
+
|
444
|
+
|
445
|
+
class SOAPInteger < XSD::XSDInteger
|
446
|
+
include SOAPBasetype
|
447
|
+
extend SOAPModuleUtils
|
448
|
+
SOAPENCType = QName.new(EncodingNamespace, IntegerLiteral)
|
449
|
+
end
|
450
|
+
|
451
|
+
class SOAPNonPositiveInteger < XSD::XSDNonPositiveInteger
|
452
|
+
include SOAPBasetype
|
453
|
+
extend SOAPModuleUtils
|
454
|
+
SOAPENCType = QName.new(EncodingNamespace, NonPositiveIntegerLiteral)
|
455
|
+
end
|
456
|
+
|
457
|
+
class SOAPNegativeInteger < XSD::XSDNegativeInteger
|
458
|
+
include SOAPBasetype
|
459
|
+
extend SOAPModuleUtils
|
460
|
+
SOAPENCType = QName.new(EncodingNamespace, NegativeIntegerLiteral)
|
461
|
+
end
|
462
|
+
|
463
|
+
class SOAPLong < XSD::XSDLong
|
464
|
+
include SOAPBasetype
|
465
|
+
extend SOAPModuleUtils
|
466
|
+
SOAPENCType = QName.new(EncodingNamespace, LongLiteral)
|
467
|
+
end
|
468
|
+
|
469
|
+
class SOAPInt < XSD::XSDInt
|
470
|
+
include SOAPBasetype
|
471
|
+
extend SOAPModuleUtils
|
472
|
+
SOAPENCType = QName.new(EncodingNamespace, IntLiteral)
|
473
|
+
end
|
474
|
+
|
475
|
+
class SOAPShort < XSD::XSDShort
|
476
|
+
include SOAPBasetype
|
477
|
+
extend SOAPModuleUtils
|
478
|
+
SOAPENCType = QName.new(EncodingNamespace, ShortLiteral)
|
479
|
+
end
|
480
|
+
|
481
|
+
class SOAPByte < XSD::XSDByte
|
482
|
+
include SOAPBasetype
|
483
|
+
extend SOAPModuleUtils
|
484
|
+
SOAPENCType = QName.new(EncodingNamespace, ByteLiteral)
|
485
|
+
end
|
486
|
+
|
487
|
+
class SOAPNonNegativeInteger < XSD::XSDNonNegativeInteger
|
488
|
+
include SOAPBasetype
|
489
|
+
extend SOAPModuleUtils
|
490
|
+
SOAPENCType = QName.new(EncodingNamespace, NonNegativeIntegerLiteral)
|
491
|
+
end
|
492
|
+
|
493
|
+
class SOAPUnsignedLong < XSD::XSDUnsignedLong
|
494
|
+
include SOAPBasetype
|
495
|
+
extend SOAPModuleUtils
|
496
|
+
SOAPENCType = QName.new(EncodingNamespace, UnsignedLongLiteral)
|
497
|
+
end
|
498
|
+
|
499
|
+
class SOAPUnsignedInt < XSD::XSDUnsignedInt
|
500
|
+
include SOAPBasetype
|
501
|
+
extend SOAPModuleUtils
|
502
|
+
SOAPENCType = QName.new(EncodingNamespace, UnsignedIntLiteral)
|
503
|
+
end
|
504
|
+
|
505
|
+
class SOAPUnsignedShort < XSD::XSDUnsignedShort
|
506
|
+
include SOAPBasetype
|
507
|
+
extend SOAPModuleUtils
|
508
|
+
SOAPENCType = QName.new(EncodingNamespace, UnsignedShortLiteral)
|
509
|
+
end
|
510
|
+
|
511
|
+
class SOAPUnsignedByte < XSD::XSDUnsignedByte
|
512
|
+
include SOAPBasetype
|
513
|
+
extend SOAPModuleUtils
|
514
|
+
SOAPENCType = QName.new(EncodingNamespace, UnsignedByteLiteral)
|
515
|
+
end
|
516
|
+
|
517
|
+
class SOAPPositiveInteger < XSD::XSDPositiveInteger
|
518
|
+
include SOAPBasetype
|
519
|
+
extend SOAPModuleUtils
|
520
|
+
SOAPENCType = QName.new(EncodingNamespace, PositiveIntegerLiteral)
|
521
|
+
end
|
522
|
+
|
523
|
+
|
524
|
+
###
|
525
|
+
## Compound datatypes.
|
526
|
+
#
|
527
|
+
class SOAPStruct < XSD::NSDBase
|
528
|
+
include Enumerable
|
529
|
+
include SOAPCompoundtype
|
530
|
+
include SOAPNameAccessible
|
531
|
+
|
532
|
+
public
|
533
|
+
|
534
|
+
def initialize(type = nil)
|
535
|
+
super()
|
536
|
+
@type = type || XSD::QName::EMPTY
|
537
|
+
@array = []
|
538
|
+
@data = []
|
539
|
+
end
|
540
|
+
|
541
|
+
def to_s
|
542
|
+
str = ''
|
543
|
+
self.each do |key, data|
|
544
|
+
str << "#{key}: #{data}\n"
|
545
|
+
end
|
546
|
+
str
|
547
|
+
end
|
548
|
+
|
549
|
+
def add(name, value)
|
550
|
+
value = SOAPNil.new if value.nil?
|
551
|
+
@array.push(name)
|
552
|
+
value.elename = value.elename.dup_name(name)
|
553
|
+
@data.push(value)
|
554
|
+
value.parent = self if value.respond_to?(:parent=)
|
555
|
+
value
|
556
|
+
end
|
557
|
+
|
558
|
+
def [](idx)
|
559
|
+
if idx.is_a?(Range)
|
560
|
+
@data[idx]
|
561
|
+
elsif idx.is_a?(Integer)
|
562
|
+
if (idx > @array.size)
|
563
|
+
raise ArrayIndexOutOfBoundsError.new('In ' << @type.name)
|
564
|
+
end
|
565
|
+
@data[idx]
|
566
|
+
else
|
567
|
+
if @array.include?(idx)
|
568
|
+
@data[@array.index(idx)]
|
569
|
+
else
|
570
|
+
nil
|
571
|
+
end
|
572
|
+
end
|
573
|
+
end
|
574
|
+
|
575
|
+
def []=(idx, data)
|
576
|
+
if @array.include?(idx)
|
577
|
+
data.parent = self if data.respond_to?(:parent=)
|
578
|
+
@data[@array.index(idx)] = data
|
579
|
+
else
|
580
|
+
add(idx, data)
|
581
|
+
end
|
582
|
+
end
|
583
|
+
|
584
|
+
def key?(name)
|
585
|
+
@array.include?(name)
|
586
|
+
end
|
587
|
+
|
588
|
+
def members
|
589
|
+
@array
|
590
|
+
end
|
591
|
+
|
592
|
+
def have_member
|
593
|
+
!@array.empty?
|
594
|
+
end
|
595
|
+
|
596
|
+
def to_obj
|
597
|
+
hash = {}
|
598
|
+
proptype = {}
|
599
|
+
each do |k, v|
|
600
|
+
value = v.respond_to?(:to_obj) ? v.to_obj : v.to_s
|
601
|
+
case proptype[k]
|
602
|
+
when :single
|
603
|
+
hash[k] = [hash[k], value]
|
604
|
+
proptype[k] = :multi
|
605
|
+
when :multi
|
606
|
+
hash[k] << value
|
607
|
+
else
|
608
|
+
hash[k] = value
|
609
|
+
proptype[k] = :single
|
610
|
+
end
|
611
|
+
end
|
612
|
+
hash
|
613
|
+
end
|
614
|
+
|
615
|
+
def each
|
616
|
+
idx = 0
|
617
|
+
while idx < @array.length
|
618
|
+
yield(@array[idx], @data[idx])
|
619
|
+
idx += 1
|
620
|
+
end
|
621
|
+
end
|
622
|
+
|
623
|
+
def replace
|
624
|
+
members.each do |member|
|
625
|
+
self[member] = yield(self[member])
|
626
|
+
end
|
627
|
+
end
|
628
|
+
|
629
|
+
def self.decode(elename, type)
|
630
|
+
s = SOAPStruct.new(type)
|
631
|
+
s.elename = elename
|
632
|
+
s
|
633
|
+
end
|
634
|
+
end
|
635
|
+
|
636
|
+
|
637
|
+
# SOAPElement is not typed so it is not derived from NSDBase.
|
638
|
+
class SOAPElement
|
639
|
+
include Enumerable
|
640
|
+
include SOAPCompoundtype
|
641
|
+
include SOAPNameAccessible
|
642
|
+
|
643
|
+
attr_accessor :type
|
644
|
+
# Text interface.
|
645
|
+
attr_accessor :text
|
646
|
+
alias data text
|
647
|
+
|
648
|
+
def initialize(elename, text = nil)
|
649
|
+
super()
|
650
|
+
if elename.nil?
|
651
|
+
elename = XSD::QName::EMPTY
|
652
|
+
else
|
653
|
+
elename = Mapping.to_qname(elename)
|
654
|
+
end
|
655
|
+
@encodingstyle = LiteralNamespace
|
656
|
+
@elename = elename
|
657
|
+
@type = nil
|
658
|
+
|
659
|
+
@array = []
|
660
|
+
@data = []
|
661
|
+
@text = text
|
662
|
+
end
|
663
|
+
|
664
|
+
def inspect
|
665
|
+
sprintf("#<%s:0x%x %s>", self.class.name, __id__, self.elename) +
|
666
|
+
(@text ? " #{@text.inspect}" : '') +
|
667
|
+
@data.collect { |ele| "\n#{ele.inspect}" }.join.gsub(/^/, ' ')
|
668
|
+
end
|
669
|
+
|
670
|
+
def set(value)
|
671
|
+
@text = value
|
672
|
+
end
|
673
|
+
|
674
|
+
# Element interfaces.
|
675
|
+
def add(value)
|
676
|
+
name = value.elename.name
|
677
|
+
@array.push(name)
|
678
|
+
@data.push(value)
|
679
|
+
value.parent = self if value.respond_to?(:parent=)
|
680
|
+
value
|
681
|
+
end
|
682
|
+
|
683
|
+
def [](idx)
|
684
|
+
if @array.include?(idx)
|
685
|
+
@data[@array.index(idx)]
|
686
|
+
else
|
687
|
+
nil
|
688
|
+
end
|
689
|
+
end
|
690
|
+
|
691
|
+
def []=(idx, data)
|
692
|
+
if @array.include?(idx)
|
693
|
+
data.parent = self if data.respond_to?(:parent=)
|
694
|
+
@data[@array.index(idx)] = data
|
695
|
+
else
|
696
|
+
add(data)
|
697
|
+
end
|
698
|
+
end
|
699
|
+
|
700
|
+
def key?(name)
|
701
|
+
@array.include?(name)
|
702
|
+
end
|
703
|
+
|
704
|
+
def members
|
705
|
+
@array
|
706
|
+
end
|
707
|
+
|
708
|
+
def have_member
|
709
|
+
!@array.empty?
|
710
|
+
end
|
711
|
+
|
712
|
+
def to_obj
|
713
|
+
if !have_member
|
714
|
+
@text
|
715
|
+
else
|
716
|
+
hash = {}
|
717
|
+
proptype = {}
|
718
|
+
each do |k, v|
|
719
|
+
value = v.respond_to?(:to_obj) ? v.to_obj : v.to_s
|
720
|
+
case proptype[k]
|
721
|
+
when :single
|
722
|
+
hash[k] = [hash[k], value]
|
723
|
+
proptype[k] = :multi
|
724
|
+
when :multi
|
725
|
+
hash[k] << value
|
726
|
+
else
|
727
|
+
hash[k] = value
|
728
|
+
proptype[k] = :single
|
729
|
+
end
|
730
|
+
end
|
731
|
+
hash
|
732
|
+
end
|
733
|
+
end
|
734
|
+
|
735
|
+
def each
|
736
|
+
idx = 0
|
737
|
+
while idx < @array.length
|
738
|
+
yield(@array[idx], @data[idx])
|
739
|
+
idx += 1
|
740
|
+
end
|
741
|
+
end
|
742
|
+
|
743
|
+
def self.decode(elename)
|
744
|
+
o = SOAPElement.new(elename)
|
745
|
+
o
|
746
|
+
end
|
747
|
+
|
748
|
+
def self.from_objs(objs)
|
749
|
+
objs.collect { |value|
|
750
|
+
if value.is_a?(SOAPElement)
|
751
|
+
value
|
752
|
+
else
|
753
|
+
k, v = value
|
754
|
+
ele = from_obj(v)
|
755
|
+
ele.elename = XSD::QName.new(nil, k)
|
756
|
+
ele
|
757
|
+
end
|
758
|
+
}
|
759
|
+
end
|
760
|
+
|
761
|
+
# when obj is a Hash or an Array:
|
762
|
+
# when key starts with "xmlattr_":
|
763
|
+
# value is added as an XML attribute with the key name however the
|
764
|
+
# "xmlattr_" is dropped from the name.
|
765
|
+
# when key starts with "xmlele_":
|
766
|
+
# value is added as an XML element with the key name however the
|
767
|
+
# "xmlele_" is dropped from the name.
|
768
|
+
# if else:
|
769
|
+
# value is added as an XML element with the key name.
|
770
|
+
def self.from_obj(obj, namespace = nil)
|
771
|
+
return obj if obj.is_a?(SOAPElement)
|
772
|
+
o = SOAPElement.new(nil)
|
773
|
+
case obj
|
774
|
+
when nil
|
775
|
+
o.text = nil
|
776
|
+
when Hash, Array
|
777
|
+
obj.each do |name, value|
|
778
|
+
addname, is_attr = parse_name(name, namespace)
|
779
|
+
if value.is_a?(Array)
|
780
|
+
value.each do |subvalue|
|
781
|
+
if is_attr
|
782
|
+
o.extraattr[addname] = subvalue
|
783
|
+
else
|
784
|
+
child = from_obj(subvalue, namespace)
|
785
|
+
child.elename = addname
|
786
|
+
o.add(child)
|
787
|
+
end
|
788
|
+
end
|
789
|
+
else
|
790
|
+
if is_attr
|
791
|
+
o.extraattr[addname] = value
|
792
|
+
else
|
793
|
+
child = from_obj(value, namespace)
|
794
|
+
child.elename = addname
|
795
|
+
o.add(child)
|
796
|
+
end
|
797
|
+
end
|
798
|
+
end
|
799
|
+
else
|
800
|
+
o.text = obj.to_s
|
801
|
+
end
|
802
|
+
o
|
803
|
+
end
|
804
|
+
|
805
|
+
def self.parse_name(obj, namespace = nil)
|
806
|
+
qname = to_qname(obj, namespace)
|
807
|
+
if /\Axmlele_/ =~ qname.name
|
808
|
+
qname = XSD::QName.new(qname.namespace, qname.name.sub(/\Axmlele_/, ''))
|
809
|
+
return qname, false
|
810
|
+
elsif /\Axmlattr_/ =~ qname.name
|
811
|
+
qname = XSD::QName.new(qname.namespace, qname.name.sub(/\Axmlattr_/, ''))
|
812
|
+
return qname, true
|
813
|
+
else
|
814
|
+
return qname, false
|
815
|
+
end
|
816
|
+
end
|
817
|
+
|
818
|
+
def self.to_qname(obj, namespace = nil)
|
819
|
+
if obj.is_a?(XSD::QName)
|
820
|
+
obj
|
821
|
+
elsif /\A(.+):([^:]+)\z/ =~ obj.to_s
|
822
|
+
XSD::QName.new($1, $2)
|
823
|
+
else
|
824
|
+
XSD::QName.new(namespace, obj.to_s)
|
825
|
+
end
|
826
|
+
end
|
827
|
+
end
|
828
|
+
|
829
|
+
|
830
|
+
class SOAPRawData < SOAPElement
|
831
|
+
def initialize(obj)
|
832
|
+
super(XSD::QName::EMPTY)
|
833
|
+
@obj = obj
|
834
|
+
end
|
835
|
+
|
836
|
+
def to_xmlpart
|
837
|
+
@obj.to_xmlpart
|
838
|
+
end
|
839
|
+
end
|
840
|
+
|
841
|
+
|
842
|
+
class SOAPREXMLElementWrap
|
843
|
+
def initialize(ele)
|
844
|
+
@ele = ele
|
845
|
+
end
|
846
|
+
|
847
|
+
def to_xmlpart
|
848
|
+
@ele.to_s
|
849
|
+
end
|
850
|
+
end
|
851
|
+
|
852
|
+
|
853
|
+
class SOAPArray < XSD::NSDBase
|
854
|
+
include SOAPCompoundtype
|
855
|
+
include Enumerable
|
856
|
+
|
857
|
+
public
|
858
|
+
|
859
|
+
attr_accessor :sparse
|
860
|
+
|
861
|
+
attr_reader :offset, :rank
|
862
|
+
attr_accessor :size, :size_fixed
|
863
|
+
attr_reader :arytype
|
864
|
+
|
865
|
+
def initialize(type = nil, rank = 1, arytype = nil)
|
866
|
+
super()
|
867
|
+
@type = type || ValueArrayName
|
868
|
+
@rank = rank
|
869
|
+
@data = Array.new
|
870
|
+
@sparse = false
|
871
|
+
@offset = Array.new(rank, 0)
|
872
|
+
@size = Array.new(rank, 0)
|
873
|
+
@size_fixed = false
|
874
|
+
@position = nil
|
875
|
+
@arytype = arytype
|
876
|
+
end
|
877
|
+
|
878
|
+
def offset=(var)
|
879
|
+
@offset = var
|
880
|
+
@sparse = true
|
881
|
+
end
|
882
|
+
|
883
|
+
def add(value)
|
884
|
+
self[*(@offset)] = value
|
885
|
+
end
|
886
|
+
|
887
|
+
def have_member
|
888
|
+
!@data.empty?
|
889
|
+
end
|
890
|
+
|
891
|
+
def [](*idxary)
|
892
|
+
if idxary.size != @rank
|
893
|
+
raise ArgumentError.new("given #{idxary.size} params does not match rank: #{@rank}")
|
894
|
+
end
|
895
|
+
retrieve(idxary)
|
896
|
+
end
|
897
|
+
|
898
|
+
def []=(*idxary)
|
899
|
+
value = idxary.slice!(-1)
|
900
|
+
if idxary.size != @rank
|
901
|
+
raise ArgumentError.new("given #{idxary.size} params(#{idxary}) does not match rank: #{@rank}")
|
902
|
+
end
|
903
|
+
idx = 0
|
904
|
+
while idx < idxary.size
|
905
|
+
if idxary[idx] + 1 > @size[idx]
|
906
|
+
@size[idx] = idxary[idx] + 1
|
907
|
+
end
|
908
|
+
idx += 1
|
909
|
+
end
|
910
|
+
data = retrieve(idxary[0, idxary.size - 1])
|
911
|
+
data[idxary.last] = value
|
912
|
+
if value.is_a?(SOAPType)
|
913
|
+
value.elename = ITEM_NAME
|
914
|
+
# Sync type
|
915
|
+
unless @type.name
|
916
|
+
@type = XSD::QName.new(value.type.namespace,
|
917
|
+
SOAPArray.create_arytype(value.type.name, @rank))
|
918
|
+
end
|
919
|
+
value.type ||= @type
|
920
|
+
end
|
921
|
+
@offset = idxary
|
922
|
+
value.parent = self if value.respond_to?(:parent=)
|
923
|
+
offsetnext
|
924
|
+
end
|
925
|
+
|
926
|
+
def each
|
927
|
+
@data.each do |data|
|
928
|
+
yield(data)
|
929
|
+
end
|
930
|
+
end
|
931
|
+
|
932
|
+
def to_a
|
933
|
+
@data.dup
|
934
|
+
end
|
935
|
+
|
936
|
+
def replace
|
937
|
+
@data = deep_map(@data) do |ele|
|
938
|
+
yield(ele)
|
939
|
+
end
|
940
|
+
end
|
941
|
+
|
942
|
+
def deep_map(ary, &block)
|
943
|
+
ary.collect do |ele|
|
944
|
+
if ele.is_a?(Array)
|
945
|
+
deep_map(ele, &block)
|
946
|
+
else
|
947
|
+
new_obj = block.call(ele)
|
948
|
+
new_obj.elename = ITEM_NAME
|
949
|
+
new_obj
|
950
|
+
end
|
951
|
+
end
|
952
|
+
end
|
953
|
+
|
954
|
+
def include?(var)
|
955
|
+
traverse_data(@data) do |v, *rank|
|
956
|
+
if v.is_a?(SOAPBasetype) && v.data == var
|
957
|
+
return true
|
958
|
+
end
|
959
|
+
end
|
960
|
+
false
|
961
|
+
end
|
962
|
+
|
963
|
+
def traverse
|
964
|
+
traverse_data(@data) do |v, *rank|
|
965
|
+
unless @sparse
|
966
|
+
yield(v)
|
967
|
+
else
|
968
|
+
yield(v, *rank) if v && !v.is_a?(SOAPNil)
|
969
|
+
end
|
970
|
+
end
|
971
|
+
end
|
972
|
+
|
973
|
+
def soap2array(ary)
|
974
|
+
traverse_data(@data) do |v, *position|
|
975
|
+
iteary = ary
|
976
|
+
rank = 1
|
977
|
+
while rank < position.size
|
978
|
+
idx = position[rank - 1]
|
979
|
+
if iteary[idx].nil?
|
980
|
+
iteary = iteary[idx] = Array.new
|
981
|
+
else
|
982
|
+
iteary = iteary[idx]
|
983
|
+
end
|
984
|
+
rank += 1
|
985
|
+
end
|
986
|
+
if block_given?
|
987
|
+
iteary[position.last] = yield(v)
|
988
|
+
else
|
989
|
+
iteary[position.last] = v
|
990
|
+
end
|
991
|
+
end
|
992
|
+
end
|
993
|
+
|
994
|
+
def position
|
995
|
+
@position
|
996
|
+
end
|
997
|
+
|
998
|
+
private
|
999
|
+
|
1000
|
+
ITEM_NAME = XSD::QName.new(nil, 'item')
|
1001
|
+
|
1002
|
+
def retrieve(idxary)
|
1003
|
+
data = @data
|
1004
|
+
rank = 1
|
1005
|
+
while rank <= idxary.size
|
1006
|
+
idx = idxary[rank - 1]
|
1007
|
+
if data[idx].nil?
|
1008
|
+
data = data[idx] = Array.new
|
1009
|
+
else
|
1010
|
+
data = data[idx]
|
1011
|
+
end
|
1012
|
+
rank += 1
|
1013
|
+
end
|
1014
|
+
data
|
1015
|
+
end
|
1016
|
+
|
1017
|
+
def traverse_data(data, rank = 1)
|
1018
|
+
idx = 0
|
1019
|
+
while idx < ranksize(rank)
|
1020
|
+
if rank < @rank and data[idx]
|
1021
|
+
traverse_data(data[idx], rank + 1) do |*v|
|
1022
|
+
v[1, 0] = idx
|
1023
|
+
yield(*v)
|
1024
|
+
end
|
1025
|
+
else
|
1026
|
+
yield(data[idx], idx)
|
1027
|
+
end
|
1028
|
+
idx += 1
|
1029
|
+
end
|
1030
|
+
end
|
1031
|
+
|
1032
|
+
def ranksize(rank)
|
1033
|
+
@size[rank - 1]
|
1034
|
+
end
|
1035
|
+
|
1036
|
+
def offsetnext
|
1037
|
+
move = false
|
1038
|
+
idx = @offset.size - 1
|
1039
|
+
while !move && idx >= 0
|
1040
|
+
@offset[idx] += 1
|
1041
|
+
if @size_fixed
|
1042
|
+
if @offset[idx] < @size[idx]
|
1043
|
+
move = true
|
1044
|
+
else
|
1045
|
+
@offset[idx] = 0
|
1046
|
+
idx -= 1
|
1047
|
+
end
|
1048
|
+
else
|
1049
|
+
move = true
|
1050
|
+
end
|
1051
|
+
end
|
1052
|
+
end
|
1053
|
+
|
1054
|
+
def self.decode(elename, type, arytype)
|
1055
|
+
typestr, nofary = parse_type(arytype.name)
|
1056
|
+
rank = nofary.count(',') + 1
|
1057
|
+
plain_arytype = XSD::QName.new(arytype.namespace, typestr)
|
1058
|
+
o = SOAPArray.new(type, rank, plain_arytype)
|
1059
|
+
size = []
|
1060
|
+
nofary.split(',').each do |s|
|
1061
|
+
if s.empty?
|
1062
|
+
size.clear
|
1063
|
+
break
|
1064
|
+
else
|
1065
|
+
size << s.to_i
|
1066
|
+
end
|
1067
|
+
end
|
1068
|
+
unless size.empty?
|
1069
|
+
o.size = size
|
1070
|
+
o.size_fixed = true
|
1071
|
+
end
|
1072
|
+
o.elename = elename
|
1073
|
+
o
|
1074
|
+
end
|
1075
|
+
|
1076
|
+
def self.create_arytype(typename, rank)
|
1077
|
+
"#{typename}[" << ',' * (rank - 1) << ']'
|
1078
|
+
end
|
1079
|
+
|
1080
|
+
TypeParseRegexp = Regexp.new('^(.+)\[([\d,]*)\]$')
|
1081
|
+
|
1082
|
+
def self.parse_type(string)
|
1083
|
+
TypeParseRegexp =~ string
|
1084
|
+
return $1, $2
|
1085
|
+
end
|
1086
|
+
end
|
1087
|
+
|
1088
|
+
|
1089
|
+
require 'soap/mapping/typeMap'
|
1090
|
+
|
1091
|
+
|
1092
|
+
end
|
@@ -127,20 +127,20 @@ public
|
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
|
-
# us_ascii = '[\
|
130
|
+
# us_ascii = '[\x1-\x7F]'
|
131
131
|
us_ascii = '[\x9\xa\xd\x20-\x7F]' # XML 1.0 restricted.
|
132
|
-
USASCIIRegexp = Regexp.new("\\A#{us_ascii}*\\z"
|
132
|
+
USASCIIRegexp = Regexp.new("\\A#{us_ascii}*\\z")
|
133
133
|
|
134
134
|
twobytes_euc = '(?:[\x8E\xA1-\xFE][\xA1-\xFE])'
|
135
135
|
threebytes_euc = '(?:\x8F[\xA1-\xFE][\xA1-\xFE])'
|
136
136
|
character_euc = "(?:#{us_ascii}|#{twobytes_euc}|#{threebytes_euc})"
|
137
|
-
EUCRegexp = Regexp.new("\\A#{character_euc}*\\z", nil, '
|
137
|
+
EUCRegexp = Regexp.new("\\A#{character_euc}*\\z", nil, 'n')
|
138
138
|
|
139
139
|
# onebyte_sjis = '[\x00-\x7F\xA1-\xDF]'
|
140
140
|
onebyte_sjis = '[\x9\xa\xd\x20-\x7F\xA1-\xDF]' # XML 1.0 restricted.
|
141
141
|
twobytes_sjis = '(?:[\x81-\x9F\xE0-\xFC][\x40-\x7E\x80-\xFC])'
|
142
142
|
character_sjis = "(?:#{onebyte_sjis}|#{twobytes_sjis})"
|
143
|
-
SJISRegexp = Regexp.new("\\A#{character_sjis}*\\z", nil, '
|
143
|
+
SJISRegexp = Regexp.new("\\A#{character_sjis}*\\z", nil, 'n')
|
144
144
|
|
145
145
|
# 0xxxxxxx
|
146
146
|
# 110yyyyy 10xxxxxx
|
@@ -151,7 +151,7 @@ public
|
|
151
151
|
fourbytes_utf8 = '(?:[\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])'
|
152
152
|
character_utf8 =
|
153
153
|
"(?:#{us_ascii}|#{twobytes_utf8}|#{threebytes_utf8}|#{fourbytes_utf8})"
|
154
|
-
UTF8Regexp = Regexp.new("\\A#{character_utf8}*\\z", nil, '
|
154
|
+
UTF8Regexp = Regexp.new("\\A#{character_utf8}*\\z", nil, 'n')
|
155
155
|
|
156
156
|
def Charset.is_us_ascii(str)
|
157
157
|
USASCIIRegexp =~ str
|
@@ -0,0 +1,182 @@
|
|
1
|
+
# XSD4R - XML Schema Namespace 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/datatypes'
|
10
|
+
|
11
|
+
|
12
|
+
module XSD
|
13
|
+
|
14
|
+
|
15
|
+
class NS
|
16
|
+
Namespace = 'http://www.w3.org/XML/1998/namespace'
|
17
|
+
|
18
|
+
KNOWN_TAG = {
|
19
|
+
XSD::Namespace => 'xsd',
|
20
|
+
XSD::InstanceNamespace => 'xsi',
|
21
|
+
}
|
22
|
+
|
23
|
+
class Assigner
|
24
|
+
attr_reader :known_tag
|
25
|
+
|
26
|
+
def initialize(known_tag)
|
27
|
+
@known_tag = known_tag.dup
|
28
|
+
@count = 0
|
29
|
+
end
|
30
|
+
|
31
|
+
def assign(ns)
|
32
|
+
if @known_tag.key?(ns)
|
33
|
+
return @known_tag[ns]
|
34
|
+
end
|
35
|
+
@count += 1
|
36
|
+
"n#{@count}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
attr_reader :default_namespace
|
41
|
+
|
42
|
+
class FormatError < Error; end
|
43
|
+
|
44
|
+
public
|
45
|
+
|
46
|
+
def initialize(tag2ns = nil)
|
47
|
+
@tag2ns = tag2ns || ns_default
|
48
|
+
@ns2tag = @tag2ns.invert
|
49
|
+
@assigner = nil
|
50
|
+
@default_namespace = nil
|
51
|
+
end
|
52
|
+
|
53
|
+
def known_tag
|
54
|
+
@assigner ||= Assigner.new(default_known_tag)
|
55
|
+
@assigner.known_tag
|
56
|
+
end
|
57
|
+
|
58
|
+
def assign(ns, tag = nil)
|
59
|
+
if tag == ''
|
60
|
+
if ns.empty?
|
61
|
+
@default_namespace = nil
|
62
|
+
else
|
63
|
+
@default_namespace = ns
|
64
|
+
end
|
65
|
+
tag
|
66
|
+
else
|
67
|
+
@assigner ||= Assigner.new(default_known_tag)
|
68
|
+
tag ||= @assigner.assign(ns)
|
69
|
+
@ns2tag[ns] = tag
|
70
|
+
@tag2ns[tag] = ns
|
71
|
+
tag
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def assigned?(ns)
|
76
|
+
@default_namespace == ns or @ns2tag.key?(ns)
|
77
|
+
end
|
78
|
+
|
79
|
+
def assigned_as_tagged?(ns)
|
80
|
+
@ns2tag.key?(ns)
|
81
|
+
end
|
82
|
+
|
83
|
+
def assigned_tag?(tag)
|
84
|
+
@tag2ns.key?(tag)
|
85
|
+
end
|
86
|
+
|
87
|
+
def clone_ns
|
88
|
+
cloned = self.class.new(@tag2ns.dup)
|
89
|
+
cloned.assigner = @assigner
|
90
|
+
cloned.assign(@default_namespace, '') if @default_namespace
|
91
|
+
cloned
|
92
|
+
end
|
93
|
+
|
94
|
+
def name(qname)
|
95
|
+
if qname.namespace == @default_namespace
|
96
|
+
qname.name
|
97
|
+
elsif tag = @ns2tag[qname.namespace]
|
98
|
+
"#{tag}:#{qname.name}"
|
99
|
+
else
|
100
|
+
raise FormatError.new("namespace: #{qname.namespace} not defined yet")
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
# no default namespace
|
105
|
+
def name_attr(qname)
|
106
|
+
if tag = @ns2tag[qname.namespace]
|
107
|
+
"#{tag}:#{qname.name}"
|
108
|
+
else
|
109
|
+
raise FormatError.new("namespace: #{qname.namespace} not defined yet")
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def compare(ns, name, rhs)
|
114
|
+
if (ns == @default_namespace)
|
115
|
+
return true if (name == rhs)
|
116
|
+
end
|
117
|
+
@tag2ns.each do |assigned_tag, assigned_ns|
|
118
|
+
if assigned_ns == ns && "#{assigned_tag}:#{name}" == rhs
|
119
|
+
return true
|
120
|
+
end
|
121
|
+
end
|
122
|
+
false
|
123
|
+
end
|
124
|
+
|
125
|
+
# $1 and $2 are necessary.
|
126
|
+
ParseRegexp = Regexp.new('\A([^:]+)(?::(.+))?\z')
|
127
|
+
|
128
|
+
def parse(str, local = false)
|
129
|
+
if ParseRegexp =~ str
|
130
|
+
if (name = $2) and (ns = @tag2ns[$1])
|
131
|
+
return XSD::QName.new(ns, name)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
XSD::QName.new(local ? nil : @default_namespace, str)
|
135
|
+
end
|
136
|
+
|
137
|
+
# For local attribute key parsing
|
138
|
+
# <foo xmlns="urn:a" xmlns:n1="urn:a" bar="1" n1:baz="2" />
|
139
|
+
# =>
|
140
|
+
# {}bar, {urn:a}baz
|
141
|
+
def parse_local(elem)
|
142
|
+
ParseRegexp =~ elem
|
143
|
+
if $2
|
144
|
+
ns = @tag2ns[$1]
|
145
|
+
name = $2
|
146
|
+
if !ns
|
147
|
+
raise FormatError.new("unknown namespace qualifier: #{$1}")
|
148
|
+
end
|
149
|
+
elsif $1
|
150
|
+
ns = nil
|
151
|
+
name = $1
|
152
|
+
else
|
153
|
+
raise FormatError.new("illegal element format: #{elem}")
|
154
|
+
end
|
155
|
+
XSD::QName.new(ns, name)
|
156
|
+
end
|
157
|
+
|
158
|
+
def each_ns
|
159
|
+
@ns2tag.each do |ns, tag|
|
160
|
+
yield(ns, tag)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
protected
|
165
|
+
|
166
|
+
def assigner=(assigner)
|
167
|
+
@assigner = assigner
|
168
|
+
end
|
169
|
+
|
170
|
+
private
|
171
|
+
|
172
|
+
def ns_default
|
173
|
+
{'xml' => Namespace}
|
174
|
+
end
|
175
|
+
|
176
|
+
def default_known_tag
|
177
|
+
KNOWN_TAG
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
|
182
|
+
end
|
data/lib/yieldmanager/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yieldmanager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -102,7 +102,7 @@ files:
|
|
102
102
|
- .document
|
103
103
|
- .gitignore
|
104
104
|
- .rspec
|
105
|
-
- .
|
105
|
+
- .ruby-version
|
106
106
|
- API_VERSION
|
107
107
|
- AVAILABLE_SERVICES
|
108
108
|
- Gemfile
|
@@ -112,10 +112,12 @@ files:
|
|
112
112
|
- Rakefile
|
113
113
|
- TODO
|
114
114
|
- lib/patch_detector.rb
|
115
|
+
- lib/soap4r_19_patch/soap/baseData.rb
|
115
116
|
- lib/soap4r_19_patch/soap/generator.rb
|
116
117
|
- lib/soap4r_19_patch/soap/property.rb
|
117
118
|
- lib/soap4r_19_patch/xsd/charset.rb
|
118
119
|
- lib/soap4r_19_patch/xsd/iconvcharset.rb
|
120
|
+
- lib/soap4r_19_patch/xsd/ns.rb
|
119
121
|
- lib/soap4r_19_patch/xsd/xmlparser.rb
|
120
122
|
- lib/wsdl/patch.rb
|
121
123
|
- lib/yieldmanager.rb
|
@@ -143,7 +145,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
143
145
|
version: '0'
|
144
146
|
segments:
|
145
147
|
- 0
|
146
|
-
hash:
|
148
|
+
hash: -1212190755149832978
|
147
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
150
|
none: false
|
149
151
|
requirements:
|
@@ -152,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
154
|
version: '0'
|
153
155
|
segments:
|
154
156
|
- 0
|
155
|
-
hash:
|
157
|
+
hash: -1212190755149832978
|
156
158
|
requirements: []
|
157
159
|
rubyforge_project:
|
158
160
|
rubygems_version: 1.8.25
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm 1.9.3
|