mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/soap/generator.rb (SOAP::SOAPGenerator#encode_tag): do not dump
XML attribute which value is nil. value "" and nil both were dumped as 'attr="value"'. [ruby-dev:29395] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
97c6bc5ffd
commit
40cefc9844
2 changed files with 19 additions and 7 deletions
|
@ -1,3 +1,9 @@
|
|||
Sat Sep 2 12:06:35 2006 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
|
||||
|
||||
* lib/soap/generator.rb (SOAP::SOAPGenerator#encode_tag): do not dump
|
||||
XML attribute which value is nil. value "" and nil both were dumped
|
||||
as 'attr="value"'. [ruby-dev:29395]
|
||||
|
||||
Sat Sep 2 12:00:32 2006 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
|
||||
|
||||
* lib/csv.rb (CSV::IOReader#initialize): use String#[](pos, len)
|
||||
|
|
|
@ -156,16 +156,22 @@ public
|
|||
end
|
||||
|
||||
def encode_tag(elename, attrs = nil)
|
||||
if !attrs or attrs.empty?
|
||||
if attrs.nil? or attrs.empty?
|
||||
@buf << "\n#{ @indent }<#{ elename }>"
|
||||
elsif attrs.size == 1
|
||||
key, value = attrs.shift
|
||||
@buf << %Q[\n#{ @indent }<#{ elename } #{ key }="#{ value }">]
|
||||
return
|
||||
end
|
||||
ary = []
|
||||
attrs.each do |key, value|
|
||||
ary << %Q[#{ key }="#{ value }"] unless value.nil?
|
||||
end
|
||||
case ary.size
|
||||
when 0
|
||||
@buf << "\n#{ @indent }<#{ elename }>"
|
||||
when 1
|
||||
@buf << %Q[\n#{ @indent }<#{ elename } #{ ary[0] }>]
|
||||
else
|
||||
@buf << "\n#{ @indent }<#{ elename } " <<
|
||||
attrs.collect { |key, value|
|
||||
%Q[#{ key }="#{ value }"]
|
||||
}.join("\n#{ @indent }#{ @indentstr * 2 }") <<
|
||||
ary.join("\n#{ @indent }#{ @indentstr * 2 }") <<
|
||||
'>'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue