atom feed7 messages in org.apache.velocity.userRe: [tools] Generating XHTML-complian...
FromSent OnAttachments
Christopher SchultzMar 5, 2012 5:15 pm 
Nathan BubnaMar 6, 2012 6:46 am 
Christopher SchultzMar 6, 2012 6:59 am 
Greg ThomasMar 6, 2012 7:08 am 
Christopher SchultzMar 6, 2012 8:08 am 
Christopher SchultzMar 6, 2012 8:12 am 
Nathan BubnaMar 6, 2012 8:56 am 
Subject:Re: [tools] Generating XHTML-compliant Javascript with ValidatorTool
From:Christopher Schultz (chr@christopherschultz.net)
Date:Mar 6, 2012 8:08:40 am
List:org.apache.velocity.user

Greg,

On 3/6/12 10:08 AM, Greg Thomas wrote:

On 6 March 2012 14:59, Christopher Schultz <chr@christopherschultz.net> wrote:

It might be nice to (continue to) have CDATA optional. In that case, && would need to be escaped (along with other stuff, of course). I think we only need to escape & < and >.

Why not simply use StringEscapeUtils.escapeXml() in commons-lang ?

That's actually what I am using. It turns out we have an escapeJavascript method in the ValidatorTool class itself which replaces things like ' " \t \n \r etc. Obviously that's not appropriate and so I was just talking about the requirements, not necessarily the implementation.

My first stab at a patch ended up escaping everything including the <script> start tag and end tags. Oops. So the solution is somewhat more complex, but I'll get it.

Thanks, -chris

PS The escapeJavascript method in ValidatorTool should probably be replaced with a call to StringEscapeUtils.escapeJavascript (for VELTOOLS 2.0.x, which uses commons-lang 2.2 - 6 years old, by the way). For commons-lang 3.x, we need StringEscapeUtils.escapeEcmaScript.