Output xml with REXML
require 'rexml/document' good_xml = %{ <groceries> <bread>W</bread> <bread>Q</bread> </groceries>} REXML::Document.new(good_xml).write