You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Schell Wolfgang <Wo...@mhm6.siemens.de> on 2000/11/14 17:40:40 UTC

RE: XSP and SQL in a well formed .XML: but got an Syntaxerror by SQL

> I wrote a short module (land-data.xml) using XSP and SQL inside.
> Cocoon-1.8 always says there is an Syntaxerror! Why?
> 
>   <sql:query>
>     SELECT Name, Kontinent
>       FROM Land 
>       WHERE Name='<xsp:expr>request.getParameter("Name")</xsp:expr>';
>   </sql:query>
> 
> What's wrong? (see attachment)

The ' and " are reserved characters in XML, so the xml file is not valid. It
might work by replacing them with "&apos;" and "&qout;" or wrapping the text
part in "<![CDATA["  "]]>" pairs.

<sql:query>
  SELECT Name, Kontinent
    FROM Land 
    WHERE
Name=&apos;<xsp:expr>request.getParameter(&quot;Name&quot;)</xsp:expr>&apos;
;
</sql:query>

or

<sql:query>
<![CDATA[
    SELECT Name, Kontinent
    FROM Land 
    WHERE
Name=']]><xsp:expr><![CDATA[request.getParameter("Name")]]></xsp:expr><![CDA
TA[';]]>
</sql:query>


Hope this helps.

Ciao


Wolfgang

--
Wolfgang Schell
Software Engineer
Siemens AG, ATD IT PS Mannheim
Tel: 	+49 (621) 456-1237
Fax: 	+49 (621) 456-2867
Mailto:wolfgang.schell@mhm6.siemens.de
Siemens AG, Dynamostr. 4, 68165 Mannheim



Virus checked  by Siemens AG ATD TD GFA Mannheim

AW: XSP and SQL in a well formed .XML: but got an Syntaxerror by SQL

Posted by Christian Parpart <tr...@gmx.de>.
> > I wrote a short module (land-data.xml) using XSP and SQL inside.
> > Cocoon-1.8 always says there is an Syntaxerror! Why?
> > 
> >   <sql:query>
> >     SELECT Name, Kontinent
> >       FROM Land 
> >       WHERE Name='<xsp:expr>request.getParameter("Name")</xsp:expr>';
> >   </sql:query>
> > 
> > What's wrong? (see attachment)
> 
> The ' and " are reserved characters in XML, so the xml file is 
> not valid. It
> might work by replacing them with "&apos;" and "&qout;" or 
> wrapping the text
> part in "<![CDATA["  "]]>" pairs.
> 
> <sql:query>
>   SELECT Name, Kontinent
>     FROM Land 
>     WHERE
> Name=&apos;<xsp:expr>request.getParameter(&quot;Name&quot;)</xsp:e
> xpr>&apos;
> ;
> </sql:query>
> 
> or
> 

> Hope this helps.
>

Yes, wonderfull, it helped.
I've changed the "'" to &apos; and cocoon transformed it right.

Regards,
Christian Parpart
mailto:cparpart@surakware.com
http://www.surakware.com (new http://surak.cocoonhsot.com)