vmote 2003/08/11 11:08:06 Modified: src/java/org/apache/fop/apps Driver.java Log: set up render(XMLReader, InputSource) as the main render() method, and normalize render(Document document) to this form. Revision Changes Path 1.20 +9 -21 xml-fop/src/java/org/apache/fop/apps/Driver.java Index: Driver.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/Driver.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- Driver.java 11 Aug 2003 17:51:25 -0000 1.19 +++ Driver.java 11 Aug 2003 18:08:06 -0000 1.20 @@ -560,7 +560,9 @@ } /** - * 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 @@ } /** - * 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); } /**
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]