Project

General

Profile

Bug #2423

REXML edge case with <a>A &gt; B</a>

Added by kwerle (Kurt Werle) over 9 years ago. Updated almost 8 years ago.

Status:
Open
Priority:
Normal
Assignee:
-
ruby -v:
ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0]
[ruby-core:27008]

Description

=begin
The attached file: rexml_test.rb was written in the context of a rails app, and used ./script/runner to execute.

It uses Nokogiri by way of comparison to REXML.

There are 4 test cases, and only the last one fails: REXML trying to parse the contents of A > B
It turns out, surprisingly, that the line <!DOCTYPE x SYSTEM "licenseOut.xsd"> is required for this to fail - without it, all tests will work.
========================================
% gem list nokogiri

*** LOCAL GEMS ***

nokogiri (1.4.0, 1.3.3, 1.3.2, 1.2.3, 1.1.0, 1.0.7)
========================================
My output (Mac OS X, Leopard):
% ./script/runner rexml_test.rb
.../monkeypatches.rb:13: warning: already initialized constant RAILS_DEFAULT_LOGGER
HI. You're using libxml2 version 2.6.16 which is over 4 years old and has
plenty of bugs. We suggest that for maximum HTML/XML parsing pleasure, you
upgrade your version of libxml2 and re-install nokogiri. If you like using
libxml2 version 2.6.16, but don't like this warning, please define the constant
I_KNOW_I_AM_USING_AN_OLD_AND_BUGGY_VERSION_OF_LIBXML2 before requring nokogiri.

/Users/lkwerle/.gem/ruby/1.8/gems/nokogiri-1.4.0/lib/nokogiri/xml/builder.rb:272: warning: parenthesize argument(s) for future version
noko_value: A bigger than B
return_string: A bigger than B
noko_value: A > B
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/entity.rb:76:in unnormalized': You have a nil object when you didn't expect it! (NoMethodError)
The error occurred while evaluating nil.record_entity_expansion
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/doctype.rb:139:in
entity'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/text.rb:325:in unnormalize'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/text.rb:323:in
each'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/text.rb:323:in unnormalize'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/text.rb:174:in
value'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/element.rb:452:in text'
from rexml_test.rb:32
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
eval'
from /.../vendor/rails/railties/lib/commands/runner.rb:46
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
require'
from ./script/runner:3
=end


Files

rexml_test.rb (828 Bytes) rexml_test.rb ./script/runner rexml_test.rb # in the context of rails 2.3.2 kwerle (Kurt Werle), 12/03/2009 10:48 AM
rexml_test.rb (847 Bytes) rexml_test.rb modified rexml test tenderlovemaking (Aaron Patterson), 12/03/2009 12:20 PM

History

#1

Updated by tenderlovemaking (Aaron Patterson) over 9 years ago

=begin
Can you try with a script that runs outside rails?

The script you've attached doesn't work. I modified it to what I think it should be, but nothing breaks on 1.8.7 or 1.8.6. I've attached the test script I used.
=end

Also available in: Atom PDF