Hi,

even though I would love to have the established character escaping with a 
backslash used in many programming languages, velocity is not up to it yet (the 
tendency is not to make it into a programming language).

Some time ago it was chosen to allow embedded double-quotes in a string by 
doubling it up - as done e.g. in CVS exports and some other M$-near string 
tools.

To my knowledge escaping of quotes was never supported by Velocity. Only 
literals can be escaped - with some curiosities - see the User Manual "Escaping 
Valid VTL References".

So in the doxia case either use a single quote for the XML attributes, or 
double-up the quotes, or use the poor-mans-escaping (TM):
  #set( $Q = '"' )

Kind regards,
Christoph

On 2010-08-02 06:18, Stefan Bodewig wrote:
> Hi all,
> 
> there is a build failure showing up in some Gump builds that seems to
> indicate a backwards incompatible change inside Velocity - which may or
> may not be intentional.
> 
> One example of the failure can be seen in the Cargo build
> <http://vmgump.apache.org/gump/public/cargo/cargo/gump_work/build_cargo_cargo.html>.
> I'll be happy to explain what Gump does, but the failure itself can be
> understood without that background.
> 
> The doxia-site-renderer Maven module contains a Velocity template which
> itself contains a line
> 
>         #set ( $documentHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" 
> )
> 
> probably with the expectaation that \" would escape the quote.  This
> seems to work with the version referenced by the module: 1.5.
> 
> If you try to parse the same template with the trunk of Velocity engine
> you get
> 
> [ERROR] org.apache.velocity.exception.ParseErrorException: Encountered "1.0" 
> at org/apache/maven/doxia/siterenderer/resources/default-site.vm[line 308, 
> column 51]
> Was expecting one of:
>     <RPAREN> ...
>     <WHITESPACE> ...
> 
> which looks as if the " before 1.0 was terminating the string literal.
> 
> I can't find any hint in Velocity's documentation that would say you can
> escape quotes in string literals, but if it worked in older versions you
> are setting some sort of expectation 8-)
> 
> Is this a regression that can/will be fixed or is this something the
> downstream users like doxia would need to adapt to?
> 
> Stefan
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to