summaryrefslogtreecommitdiff
path: root/lib/rexml
diff options
context:
space:
mode:
authorKouhei Sutou <kou@clear-code.com>2018-12-31 07:21:37 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-08-04 11:54:00 +0900
commit3583fa166c52aff1ac6fab310e9133c553efcc4a (patch)
tree0e195bc26659fd0603e4d251c89b69b47e7b51aa /lib/rexml
parentf76cfb55d7612f1bb1648112e159646321d2aa2c (diff)
[ruby/rexml] xpath: fix a bug that no namespace attribute isn't matched with prefix
[ruby-list:50733] Reported by Yasuhiro KIMURA. Thanks!!! https://github.com/ruby/rexml/commit/8f3c5c176a
Diffstat (limited to 'lib/rexml')
-rw-r--r--lib/rexml/xpath_parser.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/rexml/xpath_parser.rb b/lib/rexml/xpath_parser.rb
index e30581d3d0..47fa4ef84e 100644
--- a/lib/rexml/xpath_parser.rb
+++ b/lib/rexml/xpath_parser.rb
@@ -499,7 +499,11 @@ module REXML
else
# FIXME: This DOUBLES the time XPath searches take
ns = get_namespace(raw_node.element, prefix)
- raw_node.name == name and raw_node.namespace == ns
+ if ns.empty?
+ raw_node.name == name and raw_node.prefix.empty?
+ else
+ raw_node.name == name and raw_node.namespace == ns
+ end
end
else
false