You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Enke Michael <Mi...@wincor-nixdorf.com> on 2001/08/01 11:10:29 UTC
Re: strange Language Exception
This happened with Cocoon0730041508
Regards,
Michael
Vadim Gritsenko wrote:
>
> Do you have this problem with latest CVS version?
>
> I think that this is already fixed in CVS.
>
> Thanks,
> Vadim
>
> > -----Original Message-----
> > From: Enke Michael [mailto:Michael.Enke@wincor-nixdorf.com]
> > Sent: Tuesday, July 31, 2001 3:56 PM
> > To: cocoon-users@xml.apache.org
> > Subject: xsp: strange Language Exception
> >
> >
> > Hi folks,
> > I have a question which I cann't answer myself and maybe
> > it is an error I have found?
> >
> > Lock at this few lines:
> > ========================================
> > <?xml version="1.0" encoding="UTF-8"?>
> >
> > <xsp:page language="java"
> > xmlns:xsp="http://apache.org/xsp"
> > xmlns:i18n="http://apache.org/cocoon/i18n/2.0" encoding="UTF-8"
> > >
> >
> > <page>
> > <xsp:logic>
> > String result = "_d";
> > if(result.equals("_d")) {
> > <result>
> > <i18n:date/>
> > </result>
> > }
> > else {
> > <result>
> > <xsp:expr>result</xsp:expr>
> > </result>
> > }
> > </xsp:logic>
> > </page>
> > </xsp:page>
> > ========================================
> > It is without much sense but I wanted to concentrate on the effect.
> > In the if and else branch (in real life I have much more else if
> > branches)
> > I must repeat the <result> and </result> elements in each branch.
> >
> > My idea was to put only one <result> before <xsp:logic> and
> > only one </result> behind </xsp:logic>
> > But than I get these Exception:
> >
> > DEBUG 99660 [cocoon ] (/calypso/test_error)
> > Thread-22/ProgramGeneratorImpl: Language Exception
> > org.apache.cocoon.components.language.LanguageException: Error compiling
> > test_error_xsp:
> > Line 107, column 6: Invalid expression statement.
> > Line 107, column 14: ';' expected.
> > at
> > org.apache.cocoon.components.language.programming.java.JavaLanguage.compile(JavaLanguage.java:203)
> > at
> > org.apache.cocoon.components.language.programming.CompiledProgrammingLanguage.load(CompiledProgrammingLanguage
> > .java:140)
> > at
> > org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.generateResource(ProgramGeneratorImpl.java:276)
> > at
> > org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.load(ProgramGeneratorImpl.java:184)
> > at
> > org.apache.cocoon.generation.ServerPagesGenerator.setup(ServerPagesGenerator.java:153)
> > at
> > org.apache.cocoon.components.pipeline.AbstractEventPipeline.setupPipeline(AbstractEventPipeline.java:146)
> > ...
> >
> > Does anybody know if this is my problem because I didn't read deep
> > enough
> > into the documentation or is this a cocoon problem?
> >
> > Regards,
> > Michael
> >
> > ---------------------------------------------------------------------
> > Please check that your question has not already been answered in the
> > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> >
> > To unsubscribe, e-mail: <co...@xml.apache.org>
> > For additional commands, e-mail: <co...@xml.apache.org>
> >
> >
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: strange Language Exception
Posted by Enke Michael <Mi...@wincor-nixdorf.com>.
Thank you very much for the explanation and solution of my problem!
Michael
Vadim Gritsenko wrote:
> ...
> And here is the solution:
> <xsp:expr> can not be used this way when it immediately netsted in <xsp:logic>,
> and this is done so to enable interoperability with other stylesheets. An example of
> correct usage would be something like:
>
> <result>
> <xsp:logic>
> String result = "";
> if(result.equals("")){
> <i18n:date/>
> }else{
> result = <xsp-request:get-header name="user-agent"/>;
> }else{
> result = <xsp:expr>result</xsp:expr>;
> }
> </xsp:logic>
> <xsp:expr>result</xsp:expr>
> </result>
>
> Hope I described this clear enough,
>
> Vadim
> ...
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
RE: strange Language Exception
Posted by Vadim Gritsenko <vg...@hns.com>.
It does not correlate with XML file you sent before...
It looks like this java file was generated from different XML, something like this:
<result>
<xsp:logic>
if(...){
<i18n:date/>
}else{
<xsp:expr>result</xsp:expr>
}
</xsp:logic>
</result>
With this XML I'm able to reproduce your problem (XML file you sent before was compiling
with no problems).
And here is the solution:
<xsp:expr> can not be used this way when it immediately netsted in <xsp:logic>,
and this is done so to enable interoperability with other stylesheets. An example of
correct usage would be something like:
<result>
<xsp:logic>
String result = "";
if(result.equals("")){
<i18n:date/>
}else{
result = <xsp-request:get-header name="user-agent"/>;
}else{
result = <xsp:expr>result</xsp:expr>;
}
</xsp:logic>
<xsp:expr>result</xsp:expr>
</result>
Hope I described this clear enough,
Vadim
> -----Original Message-----
> From: Enke Michael [mailto:Michael.Enke@wincor-nixdorf.com]
> Sent: Wednesday, August 01, 2001 11:25 AM
> To: cocoon-users@xml.apache.org
> Subject: Re: strange Language Exception
>
>
> Vadim Gritsenko wrote:
> >
> > Send your test_error_xsp.java which is found under Cocoon's work directory.
> >
> > Vadim
> >
> > > -----Original Message-----
> > > From: Enke Michael [mailto:Michael.Enke@wincor-nixdorf.com]
> > > Sent: Wednesday, August 01, 2001 5:10 AM
> > > To: cocoon-users@xml.apache.org
> > > Subject: Re: strange Language Exception
> > >
> > >
> > > This happened with Cocoon0730041508
> > >
> > > Regards,
> > > Michael
> > >
> > ...
>
> Here it comes.
> Greetings,
> Michael
>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: strange Language Exception
Posted by Enke Michael <Mi...@wincor-nixdorf.com>.
Vadim Gritsenko wrote:
>
> Send your test_error_xsp.java which is found under Cocoon's work directory.
>
> Vadim
>
> > -----Original Message-----
> > From: Enke Michael [mailto:Michael.Enke@wincor-nixdorf.com]
> > Sent: Wednesday, August 01, 2001 5:10 AM
> > To: cocoon-users@xml.apache.org
> > Subject: Re: strange Language Exception
> >
> >
> > This happened with Cocoon0730041508
> >
> > Regards,
> > Michael
> >
> ...
Here it comes.
Greetings,
Michael
RE: strange Language Exception
Posted by Vadim Gritsenko <vg...@hns.com>.
Send your test_error_xsp.java which is found under Cocoon's work directory.
Vadim
> -----Original Message-----
> From: Enke Michael [mailto:Michael.Enke@wincor-nixdorf.com]
> Sent: Wednesday, August 01, 2001 5:10 AM
> To: cocoon-users@xml.apache.org
> Subject: Re: strange Language Exception
>
>
> This happened with Cocoon0730041508
>
> Regards,
> Michael
>
> Vadim Gritsenko wrote:
> >
> > Do you have this problem with latest CVS version?
> >
> > I think that this is already fixed in CVS.
> >
> > Thanks,
> > Vadim
> >
> > > -----Original Message-----
> > > From: Enke Michael [mailto:Michael.Enke@wincor-nixdorf.com]
> > > Sent: Tuesday, July 31, 2001 3:56 PM
> > > To: cocoon-users@xml.apache.org
> > > Subject: xsp: strange Language Exception
> > >
> > >
> > > Hi folks,
> > > I have a question which I cann't answer myself and maybe
> > > it is an error I have found?
> > >
> > > Lock at this few lines:
> > > ========================================
> > > <?xml version="1.0" encoding="UTF-8"?>
> > >
> > > <xsp:page language="java"
> > > xmlns:xsp="http://apache.org/xsp"
> > > xmlns:i18n="http://apache.org/cocoon/i18n/2.0" encoding="UTF-8"
> > > >
> > >
> > > <page>
> > > <xsp:logic>
> > > String result = "_d";
> > > if(result.equals("_d")) {
> > > <result>
> > > <i18n:date/>
> > > </result>
> > > }
> > > else {
> > > <result>
> > > <xsp:expr>result</xsp:expr>
> > > </result>
> > > }
> > > </xsp:logic>
> > > </page>
> > > </xsp:page>
> > > ========================================
> > > It is without much sense but I wanted to concentrate on the effect.
> > > In the if and else branch (in real life I have much more else if
> > > branches)
> > > I must repeat the <result> and </result> elements in each branch.
> > >
> > > My idea was to put only one <result> before <xsp:logic> and
> > > only one </result> behind </xsp:logic>
> > > But than I get these Exception:
> > >
> > > DEBUG 99660 [cocoon ] (/calypso/test_error)
> > > Thread-22/ProgramGeneratorImpl: Language Exception
> > > org.apache.cocoon.components.language.LanguageException: Error compiling
> > > test_error_xsp:
> > > Line 107, column 6: Invalid expression statement.
> > > Line 107, column 14: ';' expected.
> > > at
> > > org.apache.cocoon.components.language.programming.java.JavaLanguage.compile(JavaLanguage.java:203)
> > > at
> > > org.apache.cocoon.components.language.programming.CompiledProgrammingLanguage.load(CompiledProgrammingLanguage
> > > .java:140)
> > > at
> > >
> org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.generateResource(ProgramGeneratorImpl.java:276)
> > > at
> > > org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.load(ProgramGeneratorImpl.java:184)
> > > at
> > > org.apache.cocoon.generation.ServerPagesGenerator.setup(ServerPagesGenerator.java:153)
> > > at
> > > org.apache.cocoon.components.pipeline.AbstractEventPipeline.setupPipeline(AbstractEventPipeline.java:146)
> > > ...
> > >
> > > Does anybody know if this is my problem because I didn't read deep
> > > enough
> > > into the documentation or is this a cocoon problem?
> > >
> > > Regards,
> > > Michael
> > >
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>