There are templating languages whose primary use case is to generate markup
(including XML)[0] and (unless they're broken to uselessness) they should
guarantee the output is valid XML.
Since they are using Rails, they should be using Builder for this: http://api.rubyonrails.org/classes/ActionView/Base.html#labe... https://github.com/jimweirich/builder