You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Hans Näther <Ha...@charite.de> on 2007/05/16 17:35:36 UTC

Escaping problem inside method call inside xml attribute

Hi List,

I have a problem with escaping a velocity expression inside a xml
declaration. The velocity expression is a method call with an sql string
as parameter. The sql (postgresql) query string contains concatenation. 
If I do it the following way:

<param possibleValues="$sdb.getCSV(&quot;select &quot;id&quot; || '|' ||
&quot;Vorname&quot; from lq_master_data&quot;)"/>

I get an exception from the velocity parser because of the multiple
double quotes inside the method parameter.


If I try now to escape the double quotes inside the sql query:

<param possibleValues="$sdb.getCSV(&quot;select \&quot;id\&quot; || '|'
|| \&quot;Vorname\&quot; from lq_master_data&quot;)"/>

I get an sql exception because of the backslash directly before the
quote:

select \"id\"||'|'||\"Vorname\" from lq_master_data

So, velocity understood the escaping of the double quote, but the 
backslash is not removed. I have no more idea, what to do else.

Can anybody help me out?

Kind regards
Hans


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org