Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Outputting XML as text within XML (See related posts)

Return XML from the web server, and make the XML with result tags simple text. Using HTTP.responseXML the result xmldoc.documentElement.firstChild.nodeValue was then passed into a textarea.

require 'cgi'

cgi = CGI.new

puts "Content-Type: text/xml"
puts

print "<result>"
print "<![CDATA[<a>123</a>]]>" 
print "</result>"



You need to create an account or log in to post comments to this site.


Click here to browse all 5140 code snippets

Related Posts