Michael,

Thanks for the tip. However, your tip makes the problem even more
interesting.

When the 'if' statement is true, the <xsp:attribute> does appear on the
toplevel element and the XML is valid (no more array bounds exception).

But when the 'if' statement is false, the <page> element isn't the top most,
it's emitted after the <content> element. E.g. <page> is a sibling of the
<content> element and the XML has _two_ top level elements, also invalid.

Per

> -----Original Message-----
> From: Enke, Michael [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 10, 2002 2:58 AM
> To: [EMAIL PROTECTED]
> Subject: Re: XSP bug: can get generate() to skip elements using java
> 'if's
>
>
> Per Kreipke wrote:
> >
> > The following XSP snippet will cause an
> ArrayIndexOutOfBoundsException in
> > Cocoon 2.0.3 because the start of the outer element is never
> emitted to the
> > SAX stream.
> >
> > XSP Snippet:
>
>
> I would always write it as:
>
>  <xsp:page ....>
>
>   <page>
>    <xsp:logic>
>      if (!request.isUserInRole("root"))
>      {
>        <xsp:attribute name="security-error">Not authorized</xsp:attribute>
>      }
>      else
>      {
>    <xsp:content>
>
>      <!-- Build the page if authorized -->
>      <content />
>
>    </xsp:content>
>      }
>    </xsp:logic>
>   </page>
>
>  </xsp:page>
>
> note: </xsp:logic> replaced by <xsp:content>
> and <xsp:logic> replaced by </xsp:content>
>
> Michael
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
>
>


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

Reply via email to