GitHub: fix#17
There is a bug when they are used against node set. They should return
boolean value but they returned node set.
Reported by Mirko Budszuhn. Thanks!!!
https://github.com/ruby/rexml/commit/a02bf38440
* Message less confusing error to human
* Problem: Following error message is not helpful, because you have to reason
that '' actually means it's in the top-level, and the 'div' (not '</div>') is
an end tag
require "rexml/parsers/lightparser"
REXML::Parsers::LightParser.new('</div>').parse
#=> Missing end tag for '' (got 'div')
* Solution: add a special case in error handling just to change the error message
require "rexml/parsers/lightparser"
REXML::Parsers::LightParser.new('</div>').parse
#=> Unexpected top-level end tag (got 'div')
* Refactor by removing unnecessary `md` check
* Thanks @a_matsuda to review this at asakusa.rb!
https://github.com/ruby/rexml/commit/f6528d4477
NOTE: It's a backward incompatible change. If we have any serious
problems with this change, we may revert this change.
The XML namespace specification says the default namespace doesn't
apply to attribute names but it does in REXML without this change:
https://www.w3.org/TR/xml-names/#uniqAttrs
> the default namespace does not apply to attribute names
REXML reports a parse error for the following XML that is described as
a valid XML in the XML nsmaspace specification without this change:
<!-- http://www.w3.org is bound to n1 and is the default -->
<x xmlns:n1="http://www.w3.org"
xmlns="http://www.w3.org" >
<good a="1" b="2" />
<good a="1" n1:a="2" />
</x>
If attribute doesn't have prefix, the attribute should return "" for
both #prefix and #namespace.
https://github.com/ruby/rexml/commit/9e4fd552bc
It restores removed REXML::Parsers::BaseParser::UNQME_STR.
Because it's used by kramdown.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
It breaks backward compatibility than I thought. So it's disabled by
default. It means that REXML's XPath processor isn't compatible with
XPath 1.0. But it will be acceptable for users.
We can enable it by specifying "strict: true" to
REXML::XPathParser.new explicitly.
* lib/rexml/xpath.rb,
lib/rexml/xpath_parser.rb: Accept "strict: true" option.
* test/rexml/test_contrib.rb,
test/rexml/xpath/test_base.rb: Use not XPath 1.0 compatible behavior.
* test/rexml/test_jaxen.rb: Use XPath 1.0 compatible behavior.
* test/rss/test_1.0.rb,
test/rss/test_dublincore.rb,
spec/ruby/library/rexml/element/namespace_spec.rb,
spec/ruby/library/rexml/element/namespaces_spec.rb,
spec/ruby/library/rexml/element/prefixes_spec.rb: Enable again.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
The position should be counted for each nodeset but the previous
implementation counts position for union-ed nodeset.
For example, "/a/*/*[1]" should be matched to "<c1/>" and "<c2/>" with
the following XML.
<a>
<b>
<c1/>
</b>
<b>
<c2/>
</b>
</a>
But the previous implementation just returns only "<c1/>".
* lib/rexml/element.rb (REXML::Attributes#each_attribute):
Support Enumerator for no block use.
* lib/rexml/element.rb (REXML::Attributes#each):
Support Enumerator for no block use.
* lib/rexml/functions.rb (REXML::Functions.string):
Support NaN again.
* lib/rexml/xpath_parser.rb: Re-implement "Step" evaluator.
It should evaluate "AxisSpecifier", "NodeTest" and "Predicate" in one
step to respect position for each nodeset.
* test/rexml/test_jaxen.rb: Enable more tests. Remained tests should
be also enabled but it'll not be near future.
* test/rexml/xpath/test_base.rb: Fix expected value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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
lib/rexml/parsers/xpathparser.rb: Ignore white spaces in relative
location path.
test/rexml/xpath/test_base.rb: Add more test patterns and use more
debug friendly assertion style.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[Bug #14600]
* lib/rexml/parsers/xpathparser.rb: Fix a bug that "N-M" requires a space
before "-".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[Bug #14600]
* lib/rexml/xpath_parser.rb: Fix a bug that "/child::node()" returns
XML declaration and text nodes out of root element.
* test/rexml/test_jaxen.rb: Enable more tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[Bug #14600]
* lib/rexml/functions.rb: Fix a bug that "@attribute/parent" doesn't
return element of its attribute.
* test/rexml/test_jaxen.rb: Enable more tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[Bug #14600]
* lib/rexml/functions.rb: Fix a bug that "name(node-set)" returns
element instead of element name.
* test/rexml/test_jaxen.rb: Enable more tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[Bug #14600]
Reported by MSP-Greg. Thanks!!!
* lib/rexml/xpath_parser.rb: Fix a bug that "following_siblings::*[N]"
doesn't work.
* test/rexml/test_jaxen.rb: Enable only axis test for now.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
If uplevel keyword is given, the warning message is prepended
with caller file and line information and the string "warning: ".
The use of the uplevel keyword makes Kernel#warn format output
similar to how rb_warn formats output.
This patch modifies net/ftp and net/imap to use Kernel#warn
instead of $stderr.puts or $stderr.printf, since they are used
for printing warnings.
This makes lib/cgi/core and tempfile use $stderr.puts instead of
warn for debug logging, since they are used for debug printing
and not for warning.
This does not modify bundler, rubygems, or rdoc, as those are
maintained outside of ruby and probably wish to remain backwards
compatible with older ruby versions.
rb_warn_m code is originally from nobu, but I've changed it
so that it only includes the path and lineno from uplevel
(not the method), and also prepends the string "warning: ",
to make it more similar to rb_warn.
From: Jeremy Evans code@jeremyevans.net
Signed-off-by: Urabe Shyouhei shyouhei@ruby-lang.org
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/rexml/entity.rb: [DOC] drop a pointless comment.
Reported by Michael Gee (mikegee). [Fix GH-1736]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e