mirror of
https://github.com/ruby/ruby.git
synced 2025-08-24 05:25:34 +02:00
rexml: Fix XPath bug of /#{ELEMENT_NAME}
It doesn't mean that all elements which name "ELEMENT_NAME" with any namespace URI including null namespace URI. It means that all elements which name "ELEMENT_NAME" with null namespace URI. https://www.w3.org/TR/1999/REC-xpath-19991116/#NT-NodeTest > if the QName does not have a prefix, then the namespace URI is null > (this is the same way attribute names are expanded). We need to use "*[local-name()='#{ELEMENT_NAME}']" for all elements which name "ELEMENT_NAME" with any namespace URI including null namespace URI in XPath 1.0. But it's inconvenient. So this change includes "*:#{LOCAL_NAME}" syntax support that is introduced since XPath 2.0. * lib/rexml/parsers/xpathparser.rb: Support "*:#{LOCAL_NAME}" syntax that is introduced since XPath 2.0. * lib/rexml/xpath_parser.rb: * Fix namespace URI processing for "#{ELEMENT_NAME}". Now, "#{ELEMENT_NAME}" doesn't accept elements with null namespace URI. * Add "*:#{LOCAL_NAME}" support. * test/rexml/test_contrib.rb, test/rexml/test_core.rb, test/rexml/xpath/test_base.rb: Follow this change. * test/rexml/test_jaxen.rb: Fix namespace processing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b252d8ada3
commit
4d15e619eb
6 changed files with 37 additions and 21 deletions
|
@ -451,7 +451,7 @@ EOL
|
|||
end
|
||||
|
||||
def test_external_entity
|
||||
xp = '//channel/title'
|
||||
xp = '//*:channel/*:title'
|
||||
|
||||
%w{working.rss broken.rss}.each do |path|
|
||||
File.open(File.join(fixture_path(path))) do |file|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue