# REXML raw all doesn't seem to work

**URL:** <https://www.ruby-forum.com/t/rexml-raw-all-doesnt-seem-to-work/165536>\
**Category:** Ruby\
**Created:** [April 14, 2009, 11:50pm UTC](https://www.ruby-forum.com/t/rexml-raw-all-doesnt-seem-to-work/165536 "2009-04-14T23:50:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mr\_tibs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/439d5e/32.png) [@mr\_tibs](https://www.ruby-forum.com/u/mr_tibs)\
**Post date:** [April 14, 2009, 11:50pm UTC](https://www.ruby-forum.com/t/rexml-raw-all-doesnt-seem-to-work/165536/1 "2009-04-14T23:50:41Z")

</div>

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(“Bar\</  
group\>”, { :raw =\> :all }), when I do doc.write($stdout, 2), I get  
“Bar”. 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
