Josza,

youmight want to have a look at the XMLFragment interface (available both for
Cocoon 1.8 and 2.0) which facilitates the creation of SAX events (in the case of
Cocoon 2.0) for your EJBs.

One idea might be to have the entity bean (in case you are using any) or the
value objects (if you are relying on session beans) implement the relevant
method in this interface

void toSAX(ContentHandler handler)    for Cocoon 2.0

and include the output of this method via a standard <xsp:expr< tag in your XSP
page(s).

<xsp:page ...>
   <page>

     <xsl:logic>
       SomeDataTransformer transformer = new SomeDataTransformer(...);
     </xsp:logic>
     <...>
     <xsp:expr>transformer</xsp:expr>
   </page>
</xsp:page>

The contract in the above sample is that SomeDataTransformer implements the
XMLFragment interface and Cocoon 2.0 will calll the toSAX() method on your
<transformer>. In your toSAX() method, simply use the ContentHanlder instance
provided to generate the SAX events as required.

SomeDataTransformer could be a class that uses a business delegate to go to your
session bean which returns a list of domain objects. In its toSAX() method, you
could simply iterate over the list of domain objects returned and invoke the
toSAX() method recursively.

Hope this helps.

Werner

Jozsa Kristof wrote:

> Sorry for being slightly offtopic. I'm developing a J2EE application (my
> diplom work, not a commercial project), and I'm using Cocoon for web/wap
> output.
>
> I'm using the JBoss application server, and looking for a suitable way for
> converting business data coming from my CMP entity beans into XML to be able
> to pass it to Cocoon. I'm trying to use Castor XML directly on my entity
> beans at the moment, but without any success so far. Is there any other,
> maybe easier / more natural solution for doing that work? Maybe anyone has
> did such successfully in the past, and can show me any piece of example code
> for that?
>
> I can post my tries and failures with Castor privately if someone's familiar
> with that topic..
>
> Thanks much,
>
> Christopher
> --
> .Digital.Yearning.for.Networked.Assassination.and.Xenocide
>
> ---------------------------------------------------------------------
> 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: <[EMAIL PROTECTED]>
> For additional commands, e-mail: <[EMAIL PROTECTED]>


---------------------------------------------------------------------
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: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to