REXML Attributes and entities

Hi,

Maybe I’m missing something, but I’m trying to store a REXML Document
to a string, loading it back later. Storing it again. etc…

I’ve noticed the following problem:

script/console session:

xml = REXML::Document.new("<root value=" />") => … </>
xml.to_s => “<root value=” />
xml.root.attributes[‘value’] = ‘<’
xml.root.text = ‘>’
xml.to_s => “>” # fine by me, no problem…

xml2 = REXML::Document.new( xml.to_s )
xml2.to_s => ">

As you can see the root.text node is loaded back correctly…
But the attribute root.attributes[‘value’] is synchronized
incorrectly…

REXML version:

DATE = “2006/335”
VERSION = “3.1.6”

Is this a bug?!?
Does somebody have a solution for this?!?
Thanks in advance!

I found my Windows Ruby on Rails REXML (1.8.4) installation is working
perfectly. It seems a bug in the FreeBSD version which is REXML
(1.8.6). I’m trying to submit a bug report to the REXML authors, but
the server keeps timing out :frowning:

I also found the solution, there’s indeed a bug in REXML (1.8.6)

Change the code at line +/- 291 in text.rb: ( /usr/local/lib/ruby/1.8/
rexml/text.rb )
#copy = copy.gsub( EREFERENCE, ‘&’ )
copy = copy.gsub( “&”, “&” )

To
copy = copy.gsub( EREFERENCE, ‘&’ )
#copy = copy.gsub( “&”, “&” )

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs