You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Timm, Sean" <ST...@mailgo.com> on 2000/11/09 20:00:56 UTC
FW: [XalanJ2][C2] javax.xml.tranform API
Davanum,
Just in case you missed it...
- Sean T.
-----Original Message-----
From: Gary L Peskin [mailto:garyp@firstech.com]
Sent: Thursday, November 09, 2000 8:54 AM
To: xalan-dev@xml.apache.org
Subject: Re: [XalanJ2][C2] javax.xml.tranform API
Davanum Srinivas wrote:
> Thanks Scott. We bave updated C2 to use the new API. But there are some
concerns. I want to see if
> i can use only the java.xml.transform package and nothing else. Right now
this is not possible,
> Here's why...
>
> Problem #1: We need an explicit import of
"org.apache.xalan.transformer.TrAXFilter" as we cache
> templates and need to get an XMLFilter to work with in our code. We do
this as follows:
>
> public XMLFilter getXMLFilter() throws
TransformerConfigurationException
> {
> return new TrAXFilter(templates);
> }
> Problem #2: We need an explicit import of
"org.apache.xalan.transformer.TransformerImpl" as we
> need access to getInputContentHandler() and setContentHandler(). We type
cast as shown below.
>
> ContentHandler chandler =
((TransformerImpl)transformer).getInputContentHandler();
> ....
> ((TransformerImpl)transformer).setContentHandler(content);
> ....
>
> To eliminate #1 and #2, Is it possible to do the following
>
> - Add a newXMLFilter() in Templates which returns an XMLFilter
> - Add a getInputContentHandler in Transformer which returns the
ContentHandler
> - Add a setContentHandler in Transformer which can take a ContentHandler
as a parameter.
Dims --
I had these same problems when I first started working with the new
structure. Have a look in javax.xml.transform.sax. I think it has what
you're looking for. For problem #2, look at
ContentHander chandler =
SAXTransformerFactory.newTemplatesHandler();
...
SAXResult.setHandler(content);
...
You'll need to rework things a little but I think what you want will all
be in that package.
For problem #1, look at
return SAXTransformerFactory.newXMLFilter(null);
or something like that.
Look at samples/trax/Examples.java. It has lots of examples on using
the new classes.
HTH,
Gary