Forum: Ruby REXML raw all doesn't seem to work

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Mr_Tibs (Guest)
on 2009-04-15 01:50
(Received via mailing list)
Hi,

I'm trying to modify the contents of an XML document (read from file,
add nodes, write to file) and I have to make sure that I do NOT escape
any characters. The REXML documentation says that you should use :raw
=> :all as such:

doc = REXML::Document.new( source, { :raw => :all })

If I have doc = REXML::Document.new("<group name='Blah &amp; Foo'>Bar</
group>", { :raw => :all }), when I do doc.write($stdout, 2), I get
"<group name='Blah &amp;amp; Foo'>Bar</group>". I see that raw-all
works for Text and Element, but it doesn't work for Document. I looked
at the source code, and I just don't see how it could possibly work.
The Document's context should apply to @children, yet no such code
exists.

Am I using it wrong, or is this a bug?

Thanks,
Tiberiu
This topic is locked and can not be replied to.