rexml 3.1.9 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rexml might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39ed718e89f2e28e716bbaf921b7567fb49f15efd6dba9b79d4db51361e5d6f0
4
- data.tar.gz: 9edba002d8bc9d9024fb416f29eebffab6725a808e611cdd781d438cf4bb3945
3
+ metadata.gz: 7c40b34860b0aa6a9f52ff95da6dc77900cec26b19aa2ff44f5273e8820925e0
4
+ data.tar.gz: cb09dfb7da77bb5ec5c6b2acbc810267898cdf33d5d54b7bdbebcf2452b9fee5
5
5
  SHA512:
6
- metadata.gz: e8e144b341ae9192d3497814bb5fa0a091f31a0ed20185d8a09a3efc7b96edefe1042259d6e0aead8fd0ae5c9a67576c89e9b2fd2b23e1d8df5c2fdd2f3d2f53
7
- data.tar.gz: ecbe06b88adf772cec23a90b40a0201a3e4b2d52d5afb0ca6af4a2f1b780d2adacf8fc0d2b425c9e209c87027207ae4954bbbac47b743c9a748092e1203fa4d0
6
+ metadata.gz: bc64cb9eaf9012bf1e7b5fe3b5801decced322ab4a44a19c9afffd8be8da25dd3dbdef7a7b9bba22c67d5f05b54c3fec800c73f5004d1c0e08d686ed18e96de2
7
+ data.tar.gz: ee8af8e28eb56469e2a27ee306d63b4dc345c4d54d11c3a44d6cae55c0bca73f613c61f95103a104082ffcaef8a38165410a73f0af779d884fe7ded558d0cbab
data/NEWS.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # News
2
2
 
3
+ ## 3.2.0 - 2018-01-01 {#version-3-2-0}
4
+
5
+ ### Fixes
6
+
7
+ * Fixed a bug that no namespace attribute isn't matched with prefix.
8
+
9
+ [ruby-list:50731][Reported by Yasuhiro KIMURA]
10
+
11
+ * Fixed a bug that the default namespace is applied to attribute names.
12
+
13
+ NOTE: It's a backward incompatible change. If your program has any
14
+ problem with this change, please report it. We may revert this fix.
15
+
16
+ * `REXML::Attribute#prefix` returns `""` for no namespace attribute.
17
+
18
+ * `REXML::Attribute#namespace` returns `""` for no namespace attribute.
19
+
20
+ ### Thanks
21
+
22
+ * Yasuhiro KIMURA
23
+
3
24
  ## 3.1.9 - 2018-12-20 {#version-3-1-9}
4
25
 
5
26
  ### Improvements
@@ -67,15 +67,11 @@ module REXML
67
67
  # e.add_attribute( "nsa:a", "aval" )
68
68
  # e.add_attribute( "b", "bval" )
69
69
  # e.attributes.get_attribute( "a" ).prefix # -> "nsa"
70
- # e.attributes.get_attribute( "b" ).prefix # -> "elns"
70
+ # e.attributes.get_attribute( "b" ).prefix # -> ""
71
71
  # a = Attribute.new( "x", "y" )
72
72
  # a.prefix # -> ""
73
73
  def prefix
74
- pf = super
75
- if pf == ""
76
- pf = @element.prefix if @element
77
- end
78
- pf
74
+ super
79
75
  end
80
76
 
81
77
  # Returns the namespace URL, if defined, or nil otherwise
@@ -86,9 +82,26 @@ module REXML
86
82
  # e.add_attribute("nsx:a", "c")
87
83
  # e.attribute("ns:a").namespace # => "http://url"
88
84
  # e.attribute("nsx:a").namespace # => nil
85
+ #
86
+ # This method always returns "" for no namespace attribute. Because
87
+ # the default namespace doesn't apply to attribute names.
88
+ #
89
+ # From https://www.w3.org/TR/xml-names/#uniqAttrs
90
+ #
91
+ # > the default namespace does not apply to attribute names
92
+ #
93
+ # e = REXML::Element.new("el")
94
+ # e.add_namespace("", "http://example.com/")
95
+ # e.namespace # => "http://example.com/"
96
+ # e.add_attribute("a", "b")
97
+ # e.attribute("a").namespace # => ""
89
98
  def namespace arg=nil
90
99
  arg = prefix if arg.nil?
91
- @element.namespace arg
100
+ if arg == ""
101
+ ""
102
+ else
103
+ @element.namespace(arg)
104
+ end
92
105
  end
93
106
 
94
107
  # Returns true if other is an Attribute and has the same name and value,
@@ -1132,16 +1132,18 @@ module REXML
1132
1132
  old_attr[value.prefix] = value
1133
1133
  elsif old_attr.prefix != value.prefix
1134
1134
  # Check for conflicting namespaces
1135
- raise ParseException.new(
1136
- "Namespace conflict in adding attribute \"#{value.name}\": "+
1137
- "Prefix \"#{old_attr.prefix}\" = "+
1138
- "\"#{@element.namespace(old_attr.prefix)}\" and prefix "+
1139
- "\"#{value.prefix}\" = \"#{@element.namespace(value.prefix)}\"") if
1140
- value.prefix != "xmlns" and old_attr.prefix != "xmlns" and
1141
- @element.namespace( old_attr.prefix ) ==
1142
- @element.namespace( value.prefix )
1143
- store value.name, { old_attr.prefix => old_attr,
1144
- value.prefix => value }
1135
+ if value.prefix != "xmlns" and old_attr.prefix != "xmlns"
1136
+ old_namespace = old_attr.namespace
1137
+ new_namespace = value.namespace
1138
+ if old_namespace == new_namespace
1139
+ raise ParseException.new(
1140
+ "Namespace conflict in adding attribute \"#{value.name}\": "+
1141
+ "Prefix \"#{old_attr.prefix}\" = \"#{old_namespace}\" and "+
1142
+ "prefix \"#{value.prefix}\" = \"#{new_namespace}\"")
1143
+ end
1144
+ end
1145
+ store value.name, {old_attr.prefix => old_attr,
1146
+ value.prefix => value}
1145
1147
  else
1146
1148
  store value.name, value
1147
1149
  end
@@ -24,7 +24,7 @@
24
24
  module REXML
25
25
  COPYRIGHT = "Copyright © 2001-2008 Sean Russell <ser@germane-software.com>"
26
26
  DATE = "2008/019"
27
- VERSION = "3.1.9"
27
+ VERSION = "3.2.0"
28
28
  REVISION = ""
29
29
 
30
30
  Copyright = COPYRIGHT
@@ -493,9 +493,7 @@ module REXML
493
493
  if prefix.nil?
494
494
  raw_node.name == name
495
495
  elsif prefix.empty?
496
- # FIXME: This DOUBLES the time XPath searches take
497
- raw_node.name == name and
498
- raw_node.namespace == raw_node.element.namespace
496
+ raw_node.name == name and raw_node.namespace == ""
499
497
  else
500
498
  # FIXME: This DOUBLES the time XPath searches take
501
499
  ns = get_namespace(raw_node.element, prefix)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rexml
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.9
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-25 00:00:00.000000000 Z
11
+ date: 2018-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler