From: Tachikoma Date: 2008-07-22T21:14:28+09:00 Subject: Re: Source code to XML On Jul 22, 6:17 pm, Tommy Nordgren wrote: > I need to generate DocBook ProgramListing xincludes from a source code   > file. > How can I escape characters that is not valid in text : < > " & > > ------------------------------------- > This sig is dedicated to the advancement of Nuclear Power > Tommy Nordgren > tommy.nordg...@comhem.se irb(main):020:0> require 'rexml/text' => true irb(main):021:0> REXML::Text.normalize("Some & text < foo > \" bar") => "Some & text < foo > " bar" this may help