You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "Nestel, Frank" <fr...@coi.de> on 2001/11/29 13:31:26 UTC

Driver API Suggestion

Hi,

as a former (0.19 was running fine) and future user (hope I 
get 0.20.2 up again, 0.20.1 was kind of a mess in my environment)
of fop I'd first like to thank for it. Great work!

Second I have a question on the API of the Driver Object, which
is a bit about aesthetic

Deep within a XSLT Framework we use, I have code like

    // -1-
    Result outResult = obtainResult(mime, status, out);
    transformer.setErrorListener(this);
    transformer.transform(source, outResult);
    // -2-
    if ( status.getDriver() != null ) {
        status.getDriver().format();
        status.getDriver().render();
    }

with obtainResult() containing different branches e.g. like this

    Driver driver = new Driver();
    driver.setRenderer(Driver.RENDER_PDF);
    driver.setOutputStream(out);
    status.setDriver(driver); // <--------------------- -2-
    return new SAXResult(driver.getContentHandler());

-1- is fairly generic in the sense that different kinds of
sources and different kinds of results can be processed.

-2- is what I don't like. Actually the status object is the problem
since its main purpose in this sequence is to store additional 
information about the Driver object, s.th. which is not needed for
most of the other Result objects used at this point within out
Framework. 

If the the driver.getContentHandler() would return an object which 
would automatically start the format() and render() after the 
endDocument() has been fired, this would be very convenient in above 
use case.

So I wonder if it would be useful for more people to have s.th. like a
	Driver.getContentHandler(boolean autoRender)
method, which eigher returns a normal ContentHandler or one which
automatically formats and renders. Actually I haven't get a usecase
for autoRender = false arround here yet.

Thanks for your patience and reading till here.

Frank

--
Dr. Frank Sven Nestel
Principal Software Engineer

COI GmbH    Erlanger Straße 62, D-91074 Herzogenaurach
Phone +49 (0) 9132 82 4611 
http://www.coi.de, mailto:Frank.Nestel@coi.de
          COI - Solutions for Documents



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org