Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
REXML: Raw tags in element text?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Jari Williamsson, post: 4585939"] Since nothing seems to exist I wrote my own 2-line method: It adds a raw string, parses it and passes all nodes to the parent element. Here's the code if anyone else would need it: --- class REXML::Element def add_raw_text(raw_text) doc = REXML::Document.new("<fake>"+raw_text+"</fake>") doc.root.children.each { |e| self << e } end end --- Example: myelement.add_raw_text("here's a <b>bold</b> test") Best regards, Jari Williamsson [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
REXML: Raw tags in element text?
Top