[stringtemplate-interest] character escaping

Terence Parr parrt at cs.usfca.edu
Fri Aug 11 11:11:45 PDT 2006


On Aug 9, 2006, at 1:38 PM, John RW wrote:

> I think it would be convenient to provide escape functions in  
> stringtemplate to escape special xml characters.
>
> The point is that for xml attribute, and element text escaping,  
> they can be different, and it is hard to encode such logic in code,  
> as this is more representation issue. (same data, multiple views)

very true.   Currently, I suggest auto-wrapping all strings in an  
object with properties like escaped().

$data.escaped$

you can override setAttribute in ST to all wrap all strings.

Ter


More information about the stringtemplate-interest mailing list