Compressing Whitespace in an XML Document
require 'rexml/document' text = %{<doc><a>Some whitespace</a> <b>Some more</b></doc>} puts REXML::Document.new(text, { :compress_whitespace => :all }).to_s