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 +4 -4
- data/NEWS.md +21 -0
- data/lib/rexml/attribute.rb +20 -7
- data/lib/rexml/element.rb +12 -10
- data/lib/rexml/rexml.rb +1 -1
- data/lib/rexml/xpath_parser.rb +1 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c40b34860b0aa6a9f52ff95da6dc77900cec26b19aa2ff44f5273e8820925e0
|
4
|
+
data.tar.gz: cb09dfb7da77bb5ec5c6b2acbc810267898cdf33d5d54b7bdbebcf2452b9fee5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/rexml/attribute.rb
CHANGED
@@ -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 # -> "
|
70
|
+
# e.attributes.get_attribute( "b" ).prefix # -> ""
|
71
71
|
# a = Attribute.new( "x", "y" )
|
72
72
|
# a.prefix # -> ""
|
73
73
|
def prefix
|
74
|
-
|
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
|
-
|
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,
|
data/lib/rexml/element.rb
CHANGED
@@ -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
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
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
|
data/lib/rexml/rexml.rb
CHANGED
data/lib/rexml/xpath_parser.rb
CHANGED
@@ -493,9 +493,7 @@ module REXML
|
|
493
493
|
if prefix.nil?
|
494
494
|
raw_node.name == name
|
495
495
|
elsif prefix.empty?
|
496
|
-
|
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.
|
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-
|
11
|
+
date: 2018-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|