For what it is worth - I like this approach best. It gives you the power to
escape everything that you would like to do, but in the exceptional cases
you are still able to switch the escaping of in a template.
~ Leon
> The way I see it, from the point of view of velocity, whether the listener
> is intelligent or not is irrelevant. It is upto the implementor of the
> listener to decide how to proceed. The beauty here is that from velocity's
> point of view you are just providing an entry point in which the
application
> can add its own processing logic.
>
> I could probably write a small listener and acompaning macro utilities to
do
> that.
>
> public class XMLEscape implements InsersionListener
> {
> private boolean off = false;
> public String beforeInsert(String value)
> {
> if (off) return value;
> return escape(value);
> }
>
> public void turnOff(boolean v)
> {
> off = v;
> }
> ....
> }
>
> #macro(ident, $value)$xml.turnOff(true)$value$xml.turnOff(false)#end
>
> Assume the same XMLEscape object is set as the listener and the putin the
> context as "xml".
>
- Re: [PROPOSAL] InsertionListener Geir Magnusson Jr.
- RE: [PROPOSAL] InsertionListener Jose Alberto Fernandez
- Re: [PROPOSAL] InsertionListener Geir Magnusson Jr.
- RE: [PROPOSAL] InsertionListener Jose Alberto Fernandez
- Re: [PROPOSAL] InsertionListener Geir Magnusson Jr.
- Re: [PROPOSAL] InsertionListener Leon Messerschmidt
- Re: [PROPOSAL] InsertionListener Geir Magnusson Jr.
- Re: [PROPOSAL] InsertionListener Leon Messerschmidt
- Re: [PROPOSAL] InsertionListener Geir Magnusson Jr.
- RE: [PROPOSAL] InsertionListener Jose Alberto Fernandez
- RE: [PROPOSAL] InsertionListener Leon Messerschmidt
- RE: [PROPOSAL] InsertionListener Paulo Gaspar
- RE: [PROPOSAL] InsertionListener Jose Alberto Fernandez
- RE: [PROPOSAL] InsertionListener Paulo Gaspar
- Re: [PROPOSAL] InsertionListener Leon Messerschmidt
- Re: [PROPOSAL] InsertionListener Leon Messerschmidt
- RE: [PROPOSAL] InsertionListener Paulo Gaspar
- RE: [PROPOSAL] InsertionListener Geir Magnusson Jr.
- Re: [PROPOSAL] InsertionListener Rafal Krzewski
- RE: [PROPOSAL] InsertionListener Geir Magnusson Jr.
- RE: [PROPOSAL] InsertionListener Geir Magnusson Jr.
