You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Dylan Walsh <Dy...@Kadius.com> on 2001/01/12 16:05:30 UTC

Big XSP Problem with backslashes or double quotes in attribute va lues.

XSP has a problem if there is a &quot; entity reference or there is a
backslash ("\") in an attribute value, in the source XML.

For example:
title="Win a 28&quot; TV!"

This is completely legal XML, but XSP reports an error.

We are using XSP with Java, and I suspect that XSP is not escaping the
quotes in the Java files it generates for the page. Both double qoutes and
backslashes must be escaped in Java code by placing a backslash before them.
This problem does not occur if these characters appear in element content,
it only happens with attribute values. There is a mention of escaping in the
list of changes in Cocoon, but it seems not to have been done for attribute
values. We are using 1.7.4 but it also affects 1.8. 

Does anyone know a fix for this problem, as it is a headache? The bug
tracker is down, so I couldn't log the bug, so perhaps the developers could
note this issue.

Here is an example error:

java.lang.Exception: XSP Java Compiler: Compilation failed for _10_10.java
1024: ')' expected.

      "Win a 28" TV!"

                       ^
1024: String not terminated at end of line. 


Re: Big XSP Problem with backslashes or double quotes in attribute values.

Posted by Michael Bierenfeld <mi...@atmiralis.de>.
Hi !

Just checked it with :

<page title="Carrier Mask \&quot; Hello" stylesheet="../.

This results in a page called "Carrier Mask " Hello". Works fine for me.
But maybe I am misunderstandig you. Java Result has to have a "\" before
the """. So this results in a String whatever = new String ("Carrier
Mask \" Hello "); that is correct.

Regards

Michael