$ ruby code1.rb
/usr/lib/ruby/site_ruby/rexml/document.rb:187:in build': undefined method add_element’ for nil:NilClass (NoMethodError)
from /usr/lib/ruby/site_ruby/rexml/document.rb:44:in initialize' from code1.rb:4:in new’
from code1.rb:4
$ ruby code2.rb
/usr/lib/ruby/site_ruby/rexml/document.rb:187:in build': undefined method add_element’ for nil:NilClass (NoMethodError)
from /usr/lib/ruby/site_ruby/rexml/document.rb:44:in initialize' from code2.rb:21:in new’
from code2.rb:21
I should email Koen but maybe you’re in contact, James :-?
No. I just happened to hear about the article and thought it worth a
mention here. I skimmed it, but did not read through it, and have no
contact with the author.
Thanks for testing and finding the bug! I’m not involved with the
project but
did find this on the author’s website:
"You can submit bug reports and feature requests, and view the list of
known
bugs, at the REXML bug report page. Please do submit bug reports. If you
really
want your bug fixed fast, include an runit or Test::Unit method (or
methods)
that illustrates the problem. At the very least, send me some XML that
REXML
doesn’t process properly.
You don’t have to send an entire test suite – just the unit test
methods. If
you don’t send me a unit test, I’ll have to write one myself, which will
mean
that your bug will take longer to fix.
When submitting bug reports, please include the version of Ruby and of
REXML
that you’re using, and the operating system you’re running on. Just run:
ruby
-vrrexml/rexml -e ‘p REXML::Version,PLATFORM’ and paste the results in
your bug
report."
D:/RUBY/lib/ruby/1.8/rexml/output.rb:17:
in `<<': undefined method `encode' for #<REXML::Output:0x4ed44f4>
(NoMethodError)
from D:/RUBY/lib/ruby/1.8/rexml/xmldecl.rb:43:in `write'
from D:/RUBY/lib/ruby/1.8/rexml/document.rb:163:in `write'
from D:/RUBY/lib/ruby/1.8/rexml/document.rb:161:in `each'
from D:/RUBY/lib/ruby/1.8/rexml/document.rb:161:in `write'
from D:/RUBY/lib/ruby/1.8/rexml/node.rb:23:in `to_s'
from D:/ruby/DfB/ReXML/rbA163.TMP:14:in `puts'
from D:/ruby/DfB/ReXML/rbA163.TMP:14
=end
daz
#-> true
doc = REXML::Document.new(string)
from D:/RUBY/lib/ruby/1.8/rexml/xmldecl.rb:43:in write' from D:/RUBY/lib/ruby/1.8/rexml/document.rb:163:inwrite’
from D:/RUBY/lib/ruby/1.8/rexml/document.rb:161:in each' from D:/RUBY/lib/ruby/1.8/rexml/document.rb:161:inwrite’
from D:/RUBY/lib/ruby/1.8/rexml/node.rb:23:in to_s' from D:/ruby/DfB/ReXML/rbA163.TMP:14:inputs’
from D:/ruby/DfB/ReXML/rbA163.TMP:14
=end
daz
Hmm, now that you mention it… I have that problem with writing XML
with
This example is the ‘essence’ of my single/double quoting issue of
attributes, of course. Commenting in the 5 lines above will lead to
doubly quoted attribute values.
Happy rubying
Stephan
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.