зеркало из https://github.com/github/ruby.git
* lib/rexml/formatters/default.rb (write_attribute): fix an
exception when printing a document when duplicate namespaced attributes exist. Thanks, Alexey Froloff [ruby-core:2389] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
d05112b942
Коммит
197eea3404
|
@ -1,3 +1,9 @@
|
|||
Sun Nov 29 06:37:53 2009 Aaron Patterson <tenderlove@ruby-lang.org>
|
||||
|
||||
* lib/rexml/formatters/default.rb (write_attribute): fix an
|
||||
exception when printing a document when duplicate namespaced
|
||||
attributes exist. Thanks, Alexey Froloff [ruby-core:2389]
|
||||
|
||||
Sat Nov 28 09:05:53 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* vm_eval.c (check_funcall_failed): should rescue user raised
|
||||
|
|
|
@ -63,7 +63,9 @@ module REXML
|
|||
def write_element( node, output )
|
||||
output << "<#{node.expanded_name}"
|
||||
|
||||
node.attributes.to_a.sort_by {|attr| attr.name}.each do |attr|
|
||||
node.attributes.to_a.map { |a|
|
||||
Hash === a ? a.values : a
|
||||
}.flatten.sort_by {|attr| attr.name}.each do |attr|
|
||||
output << " "
|
||||
attr.write( output )
|
||||
end unless node.attributes.empty?
|
||||
|
|
|
@ -2,6 +2,25 @@ require "rexml/document"
|
|||
require "test/unit"
|
||||
|
||||
class REXML::TestDocument < Test::Unit::TestCase
|
||||
def test_version_attributes_to_s
|
||||
doc = REXML::Document.new(<<-eoxml)
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg id="svg2"
|
||||
xmlns:sodipodi="foo"
|
||||
xmlns:inkscape="bar"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.44.1"
|
||||
>
|
||||
</svg>
|
||||
eoxml
|
||||
|
||||
string = doc.to_s
|
||||
assert_match('xmlns:sodipodi', string)
|
||||
assert_match('xmlns:inkscape', string)
|
||||
assert_match('sodipodi:version', string)
|
||||
assert_match('inkscape:version', string)
|
||||
end
|
||||
|
||||
def test_new
|
||||
doc = REXML::Document.new(<<EOF)
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
|
Загрузка…
Ссылка в новой задаче