Team,

For internal xml/xslt -> fo translation,  we are
currently using XSLTInputHandler in three places:
CommandLineOptions, FopPrintServlet and
TestConverter.java.  (TraxInputHandler isn't being
used internally.)  I would like us to switch from
XSLTInputHandler to JAXP.

For CommandLineOptions, I am thinking of converting
the getInputHandler() to always return an
FOInputHandler() as follows:

public InputHandler getInputHandler() throws
FOPException {
    switch (inputmode) {
        case FO_INPUT:
            return new FOInputHandler(fofile);
        case XSLT_INPUT:
// begin new lines
            ByteArrayOutputStream baos = new
ByteArrayOutputStream();
            TransformerFactory tFactory =
TransformerFactory.newInstance();
            Transformer transformer =
tFactory.newTransformer
                (new StreamSource(xsltfile);
            transformer.transform(new
StreamSource(xmlfile), 
                new StreamResult(baos));                  
            byte bytes[] = baos.toByteArray();
            ByteArrayInputStream bais = new
ByteArrayInputStream(bytes);
            return new FOInputHandler(bais);
// end new lines
            //  return new XSLTInputHandler(xmlfile,
xsltfile);
        default:
            return new FOInputHandler(fofile);
}


FOInputHandler, in turn, will be modified to take a
ByteArrayInputStream in addition to its current
capability of URL's and Files:

public InputSource getInputSource() {
    if (fofile != null) {
       return super.fileInputSource(fofile);
    }
    else if (foURL != null) {
        return super.urlInputSource(foURL);
    }
    return streamInputSource(foStream);  // new line
}

>From here, code proceeds normally (works because
Driver can handle different types of InputSources,
including streamInputSources, already.)  I've tested
it locally, it works well.  I would next make similar
changes to FopPrintServlet (which already has a TODO
to get rid of XSLTInputHandler anyway) and
TestConverter.java as well.

Here is my +1.

Thanks,
Glen


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to