[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Comments in REXML

Jari Williamsson

12/19/2007 10:48:00 PM

How do I add a XML comment between 2 element nodes in REXML? I've read
the documentation over and over, but I just can't find out...


Best regards,

Jari Williamsson

1 Answer

msnews.microsoft.com

12/20/2007 2:09:00 AM

0

require "rexml/document"

doc = REXML::Document.new('<root/>')

doc.root << REXML::Element.new('elem1')
doc.root << REXML::Comment.new('this is a comment')

res = doc.to_s # => "<root><elem1/><!--this is a comment--></root>"


Jari Williamsson wrote:
> How do I add a XML comment between 2 element nodes in REXML? I've read
> the documentation over and over, but I just can't find out...
>
>
> Best regards,
>
> Jari Williamsson
>
>