summaryrefslogtreecommitdiff
path: root/lib/rexml
diff options
context:
space:
mode:
authorKouhei Sutou <kou@clear-code.com>2019-01-01 06:02:37 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-08-04 11:54:22 +0900
commit9b36f0a787dfb1a2a3875b827b455b5a9a2f2680 (patch)
treeb116429d91866298eecf543586cc64194b25409b /lib/rexml
parent84c3742466fa78b48902d340345cddd04569b81f (diff)
[ruby/rexml] Format
https://github.com/ruby/rexml/commit/2384586811
Diffstat (limited to 'lib/rexml')
-rw-r--r--lib/rexml/element.rb22
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/rexml/element.rb b/lib/rexml/element.rb
index 7903d83453..de83ec3b51 100644
--- a/lib/rexml/element.rb
+++ b/lib/rexml/element.rb
@@ -1132,16 +1132,18 @@ module REXML
old_attr[value.prefix] = value
elsif old_attr.prefix != value.prefix
# Check for conflicting namespaces
- raise ParseException.new(
- "Namespace conflict in adding attribute \"#{value.name}\": "+
- "Prefix \"#{old_attr.prefix}\" = "+
- "\"#{@element.namespace(old_attr.prefix)}\" and prefix "+
- "\"#{value.prefix}\" = \"#{@element.namespace(value.prefix)}\"") if
- value.prefix != "xmlns" and old_attr.prefix != "xmlns" and
- @element.namespace( old_attr.prefix ) ==
- @element.namespace( value.prefix )
- store value.name, { old_attr.prefix => old_attr,
- value.prefix => value }
+ if value.prefix != "xmlns" and old_attr.prefix != "xmlns"
+ old_namespace = @element.namespace(old_attr.prefix)
+ new_namespace = @element.namespace(value.prefix)
+ if old_namespace == new_namespace
+ raise ParseException.new(
+ "Namespace conflict in adding attribute \"#{value.name}\": "+
+ "Prefix \"#{old_attr.prefix}\" = \"#{old_namespace}\" and "+
+ "prefix \"#{value.prefix}\" = \"#{new_namespace}\"")
+ end
+ end
+ store value.name, {old_attr.prefix => old_attr,
+ value.prefix => value}
else
store value.name, value
end