diff options
author | William Victor Mote <vmote@apache.org> | 2003-08-11 18:08:06 +0000 |
---|---|---|
committer | William Victor Mote <vmote@apache.org> | 2003-08-11 18:08:06 +0000 |
commit | 3c31a165f3353a829d837696be9604c0f26132c0 (patch) | |
tree | 3231a909f19e7c82b24e18cab017426c7fb6838f | |
parent | f2f5b624bb0ffe3cdd3dff935d2934fcaf4970ef (diff) | |
download | xmlgraphics-fop-3c31a165f3353a829d837696be9604c0f26132c0.tar.gz xmlgraphics-fop-3c31a165f3353a829d837696be9604c0f26132c0.zip |
set up render(XMLReader, InputSource) as the main render() method, and normalize render(Document document) to this form.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196782 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/java/org/apache/fop/apps/Driver.java | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/src/java/org/apache/fop/apps/Driver.java b/src/java/org/apache/fop/apps/Driver.java index 1879efd83..b72b83307 100644 --- a/src/java/org/apache/fop/apps/Driver.java +++ b/src/java/org/apache/fop/apps/Driver.java @@ -560,7 +560,9 @@ public class Driver implements LogEnabled { } /** - * Render the FO document read by a SAX Parser from an InputSource. + * This is the main render() method. The other render() methods are for + * convenience, and normalize to this form, then run this. + * Renders the FO document read by a SAX Parser from an InputSource. * @param parser the SAX parser. * @param source the input source the parser reads from. * @throws FOPException if anything goes wrong. @@ -586,31 +588,17 @@ public class Driver implements LogEnabled { } /** - * Render the FO ducument represented by a DOM Document. + * This method overloads the main render() method, adding the convenience + * of using a DOM Document as input. + * @see render(XMLReader, InputSource) * @param document the DOM document to read from * @throws FOPException if anything goes wrong. */ public synchronized void render(Document document) throws FOPException { - if (!isInitialized()) { - initialize(); - } - try { - DocumentInputSource source = new DocumentInputSource(document); - DocumentReader reader = new DocumentReader(); - reader.setContentHandler(getContentHandler()); - reader.parse(source); - } catch (SAXException e) { - if (e.getException() instanceof FOPException) { - // Undo exception tunneling. - throw (FOPException)e.getException(); - } else { - throw new FOPException(e); - } - } catch (IOException e) { - throw new FOPException(e); - } - + DocumentInputSource source = new DocumentInputSource(document); + DocumentReader reader = new DocumentReader(); + render(reader, source); } /** |