* 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
@ -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>
|
Sat Sep 2 12:00:32 2006 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
|
||||||
|
|
||||||
* lib/csv.rb (CSV::IOReader#initialize): use String#[](pos, len)
|
* lib/csv.rb (CSV::IOReader#initialize): use String#[](pos, len)
|
||||||
|
@ -156,16 +156,22 @@ public
|
|||||||
end
|
end
|
||||||
|
|
||||||
def encode_tag(elename, attrs = nil)
|
def encode_tag(elename, attrs = nil)
|
||||||
if !attrs or attrs.empty?
|
if attrs.nil? or attrs.empty?
|
||||||
@buf << "\n#{ @indent }<#{ elename }>"
|
@buf << "\n#{ @indent }<#{ elename }>"
|
||||||
elsif attrs.size == 1
|
return
|
||||||
key, value = attrs.shift
|
end
|
||||||
@buf << %Q[\n#{ @indent }<#{ elename } #{ key }="#{ value }">]
|
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
|
else
|
||||||
@buf << "\n#{ @indent }<#{ elename } " <<
|
@buf << "\n#{ @indent }<#{ elename } " <<
|
||||||
attrs.collect { |key, value|
|
ary.join("\n#{ @indent }#{ @indentstr * 2 }") <<
|
||||||
%Q[#{ key }="#{ value }"]
|
|
||||||
}.join("\n#{ @indent }#{ @indentstr * 2 }") <<
|
|
||||||
'>'
|
'>'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user