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. I like that approach because if there is an error loading the data I can 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. So my suggestion to you would be to see if you can load your customer data in the setup() of a transformer, and then only serialize it once the tag you are looking for is encountered. I hope that makes sense :) -pete -- peter royal -> [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]>