diff options
Diffstat (limited to 'lib/soap/element.rb')
-rw-r--r-- | lib/soap/element.rb | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/soap/element.rb b/lib/soap/element.rb index 1494cd61dd..20d7c3bb2c 100644 --- a/lib/soap/element.rb +++ b/lib/soap/element.rb @@ -1,5 +1,5 @@ # SOAP4R - SOAP elements library -# Copyright (C) 2000, 2001, 2003, 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. +# Copyright (C) 2000, 2001, 2003-2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; @@ -99,7 +99,15 @@ class SOAPBody < SOAPStruct super(nil) @elename = EleBodyName @encodingstyle = nil - add(data.elename.name, data) if data + if data + if data.respond_to?(:elename) + add(data.elename.name, data) + else + data.to_a.each do |datum| + add(datum.elename.name, datum) + end + end + end @is_fault = is_fault end @@ -129,7 +137,7 @@ class SOAPBody < SOAPStruct end end - raise SOAPParser::FormatDecodeError.new('No root element.') + raise Parser::FormatDecodeError.new('no root element') end end @@ -231,8 +239,7 @@ class SOAPEnvelope < XSD::NSDBase end def encode(generator, ns, attrs = {}) - SOAPGenerator.assign_ns(attrs, ns, EnvelopeNamespace, - SOAPNamespaceTag) + SOAPGenerator.assign_ns(attrs, ns, EnvelopeNamespace, SOAPNamespaceTag) name = ns.name(@elename) generator.encode_tag(name, attrs) |