Christian --

Perhaps you could let your user specify either a ContentHandler or a
TransformerHandler.  If the user just specified a ContentHandler, you
could wrap that in your own TransformerHandler that would provide
implementations of the non-ContentHandler methods.  Your
TransformerHandler could get the output destination from the command
line or anywhere else you chose while delegating all ContentHandler
methods to the user-supplied ContentHandler.

HTH,
Gary

> -----Original Message-----
> From: Christian Mallwitz [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, April 08, 2002 9:24 AM
> To: '[EMAIL PROTECTED]'
> Subject: What should my application support: ContentHandler 
> vs. TransformerHandler interface
> 
> 
> Hi,
> 
> I have a standalone Java application with embedded Xalan-2. 
> The user can specify/configure an input, an output and a 
> style sheet file. Now I want to support something similar to 
> the -CONTENTHANDLER option of the Xalan command line 
> interface and have a question on how to put the transfomation 
> API to good use.
> 
> The problem: If a content handler class is specified the 
> output of the transformation should end up in the output file 
> configured. But the ContentHandler interface doesn't let me 
> tell it where to put the result of all this content handling. 
> For example the ContentHandler in "XSLT Programmer's 
> Reference" chapter 9 "A Family Tree" just writes to standard 
> out. Which leads to the TransformerHandler interface. If my 
> application supports the TransformerHandler interface I can 
> define a StreamResult and everything is fine.
> 
> What should my app let the user specify: ContentHandler or 
> TransformerHandler classes? Should I force my users to 
> implement more then is necessary for content handling (i.e. 
> LexicalHandler and DTDHandler form
> TransformerHandler) when providing a custom ContentHandler? 
> Maybe TransformerHandler is the better idea anyway? My 
> priority is output content handling only and not chaining of 
> transformations. Or do I miss something else completely?
> 
> Sorry if this list isn't 100% appropriate to discuss this ... 
> Christian
> -- 
> Christian Mallwitz INTERSHOP Communications Germany
> Senior Technical Consultant phone: +49 3641 50 3453
> 

Reply via email to