[ruby-cvs:70326] kou:r63236 (trunk): rexml: Fix XPath bug of /#{ELEMENT_NAME}
kou at ruby-lang.org
kou at ruby-lang.org
Sun Apr 22 17:09:04 JST 2018
kou 2018-04-22 17:09:04 +0900 (Sun, 22 Apr 2018)
New Revision: 63236
https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63236
Log:
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.
Modified files:
trunk/lib/rexml/parsers/xpathparser.rb
trunk/lib/rexml/xpath_parser.rb
trunk/test/rexml/test_contrib.rb
trunk/test/rexml/test_core.rb
trunk/test/rexml/test_jaxen.rb
trunk/test/rexml/xpath/test_base.rb
More information about the ruby-cvs
mailing list