cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jozsa Kristof <>
Subject Re: Transformers vs. Generators
Date Thu, 15 Nov 2001 17:58:35 GMT
On Thu, Nov 15, 2001 at 12:28:30PM -0500, Peter Royal wrote:
> On Thursday 15 November 2001 11:50 am, you wrote:
> > Okay, one piece of theoratical question. If I want to use xml data output
> > from a bunch of EJBs (JBoss+Cocoon stuff), shall I better write a
> > Transformer or a Generator for getting the data?
> >
> > I'd vote for Transformers, which looks for xml tags in a source xml like
> > <customer-data/>, and replaces it with the business data coming from EJBs,
> > which gets rendered by an other (eg. the default XSLT) Transformer right
> > after.
> >
> > Is that the correct way handling the situation?
> That works, but exception handling that way can be a pain because you can 
> only throw a SAXException once the transformer gets going.
> I recently refactored my project to use a lot of transformers, I think its 
> more manageable that way. 
I have a transformer that inserts data similar to 
> your need, and it works by loading the data in the setup() method, and then 
> spitting it out once the appropriate tag is seen.

Can you handle situations using this approach where the data changes
meanwhile? Does the setup() runs only once at Cocoon initialization or it
runs once at every page request? 

> throw a ProcessingException and there is the chance for a nice error page to 
> be shown to the user. Once the SAX stream starts going, an exception could 
> result in a 1/2 rendered page for the client, not good IMHO.

Yeah, clear.. very good point!

Thanks for the pieces of advice,


Please check that your question has not already been answered in the
FAQ before posting. <>

To unsubscribe, e-mail: <>
For additional commands, e-mail: <>

View raw message