Rexml - get raw xml of elements and text

I’m aware that REXML’s Element class can give me the elements or the
text
(texts if there are many text elements between children elements). I
want
them both, and I want them in order, straight XML. (I’ve got some bold
and
italic tags there that are just for formatting)

Ammon C. wrote:

I’m aware that REXML’s Element class can give me the elements or the text
(texts if there are many text elements between children elements). I want
them both, and I want them in order, straight XML. (I’ve got some bold and
italic tags there that are just for formatting)

to_s ?

James

http://www.ruby-doc.org - Ruby Help & Documentation
Ruby Code & Style - Ruby Code & Style: Writers wanted
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com - Playing with Better Toys
http://www.30secondrule.com - Building Better Tools

On Dec 20, 2005, at 4:51 PM, Ammon C. wrote:

I’m aware that REXML’s Element class can give me the elements or
the text
(texts if there are many text elements between children elements).
I want
them both, and I want them in order, straight XML. (I’ve got some
bold and
italic tags there that are just for formatting)

irb(main):001:0> require ‘rexml/document’
=> true

irb(main):002:0> d = REXML::Document.new( ‘Hello there
world’ )
=> … </>

irb(main):003:0> d.root.each_child{ |n| p n }
“Hello "
… </>
" world”
=> ["Hello “, … </>, " world”]