[stringtemplate-interest] Escaping

Tom Bentley tom at egressive.com
Sun May 1 16:49:25 PDT 2005


Hi All,

I have a question about escaping:

On the one hand, I have a domain model which knows nothing about XML. 
Various classes have getters which could return an arbitrary String, 
including characters such as '&', '<', and '>' (i.e. not XML encoded as 
&amp; &lt; and &gt;).

On the other hand I have a StringTemplate instance that tries to 
produces some XML output based on the domain model. StringTemplate 
doesn't know about XML either.

So my question is: How can I ensure that characters such as '&', '<', 
and '>' are correctly encoded  in the XML output.

Having had a brief scan of the documentation 
(http://www.stringtemplate.org/doc/doc.tml) I can't see that this issue 
is addressed.

Thanks!

Tom


More information about the stringtemplate-interest mailing list