* lib/rexml/parsers/baseparser.rb: use meaningful name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kou 2012-02-02 12:48:45 +00:00
parent 92cecf79b4
commit ca77bce66d
2 changed files with 17 additions and 13 deletions

View File

@ -1,3 +1,7 @@
Thu Feb 2 21:48:18 2012 Kouhei Sutou <kou@cozmixng.org>
* lib/rexml/parsers/baseparser.rb: use meaningful names.
Thu Feb 2 21:38:52 2012 Kouhei Sutou <kou@cozmixng.org> Thu Feb 2 21:38:52 2012 Kouhei Sutou <kou@cozmixng.org>
* lib/rexml/parsers/baseparser.rb, test/rexml/test_namespace.rb: * lib/rexml/parsers/baseparser.rb, test/rexml/test_namespace.rb:

View File

@ -373,31 +373,31 @@ module REXML
if md[4].size > 0 if md[4].size > 0
attrs = md[4].scan( ATTRIBUTE_PATTERN ) attrs = md[4].scan( ATTRIBUTE_PATTERN )
raise REXML::ParseException.new( "error parsing attributes: [#{attrs.join ', '}], excess = \"#$'\"", @source) if $' and $'.strip.size > 0 raise REXML::ParseException.new( "error parsing attributes: [#{attrs.join ', '}], excess = \"#$'\"", @source) if $' and $'.strip.size > 0
attrs.each { |a,b,c,d,e| attrs.each do |name, prefix, local_part, quote, value|
if b == "xmlns" if prefix == "xmlns"
if c == "xml" if local_part == "xml"
if e != "http://www.w3.org/XML/1998/namespace" if value != "http://www.w3.org/XML/1998/namespace"
msg = "The 'xml' prefix must not be bound to any other namespace "+ msg = "The 'xml' prefix must not be bound to any other namespace "+
"(http://www.w3.org/TR/REC-xml-names/#ns-decl)" "(http://www.w3.org/TR/REC-xml-names/#ns-decl)"
raise REXML::ParseException.new( msg, @source, self ) raise REXML::ParseException.new( msg, @source, self )
end end
elsif c == "xmlns" elsif local_part == "xmlns"
msg = "The 'xmlns' prefix must not be declared "+ msg = "The 'xmlns' prefix must not be declared "+
"(http://www.w3.org/TR/REC-xml-names/#ns-decl)" "(http://www.w3.org/TR/REC-xml-names/#ns-decl)"
raise REXML::ParseException.new( msg, @source, self) raise REXML::ParseException.new( msg, @source, self)
end end
curr_ns << c curr_ns << local_part
elsif b elsif prefix
prefixes << b unless b == "xml" prefixes << prefix unless prefix == "xml"
end end
if attributes.has_key? a if attributes.has_key?(name)
msg = "Duplicate attribute #{a.inspect}" msg = "Duplicate attribute #{name.inspect}"
raise REXML::ParseException.new( msg, @source, self) raise REXML::ParseException.new(msg, @source, self)
end end
attributes[a] = e attributes[name] = value
} end
end end
# Verify that all of the prefixes have been defined # Verify that all of the prefixes have been defined