From: Glen Mazza Date: Mon, 4 Aug 2003 00:52:16 +0000 (+0000) Subject: 1.) only partly implemented Run() function removed from InputHandler and its subclass... X-Git-Tag: Root_Temp_KnuthStylePageBreaking~1230 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9ba242bf2ee41e79505c367226d67d53e9c172cd;p=xmlgraphics-fop.git 1.) only partly implemented Run() function removed from InputHandler and its subclasses; Driver.Run(InputHandler) can be used instead; now all processing centralized in Driver class. 2.) getParserClassName() moved from Driver to (to be renamed) FOInputHandler; now the same class that provides the parser provides its description. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196771 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/apps/Driver.java b/src/java/org/apache/fop/apps/Driver.java index 8ea305751..5f6b15679 100644 --- a/src/java/org/apache/fop/apps/Driver.java +++ b/src/java/org/apache/fop/apps/Driver.java @@ -76,8 +76,6 @@ import org.xml.sax.ContentHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParserFactory; // Java import java.io.IOException; @@ -223,22 +221,6 @@ public class Driver implements LogEnabled { private Logger log = null; private FOUserAgent userAgent = null; - /** - * Returns the fully qualified classname of the standard XML parser for FOP - * to use. - * @return the XML parser classname - */ - public static final String getParserClassName() { - try { - return javax.xml.parsers.SAXParserFactory.newInstance() - .newSAXParser().getXMLReader().getClass().getName(); - } catch (javax.xml.parsers.ParserConfigurationException e) { - return null; - } catch (org.xml.sax.SAXException e) { - return null; - } - } - /** * Main constructor for the Driver class. */ diff --git a/src/java/org/apache/fop/apps/FOInputHandler.java b/src/java/org/apache/fop/apps/FOInputHandler.java index 1c52f75ee..f2696f889 100644 --- a/src/java/org/apache/fop/apps/FOInputHandler.java +++ b/src/java/org/apache/fop/apps/FOInputHandler.java @@ -105,13 +105,6 @@ public class FOInputHandler extends InputHandler { return createParser(); } - /** - * @see org.apache.fop.apps.InputHandler#run(Driver) - */ - public void run(Driver driver) throws FOPException { - throw new FOPException("not implemented: FOInputHandler.run(Driver)"); - } - /** * Creates XMLReader object using default * SAXParserFactory @@ -136,5 +129,17 @@ public class FOInputHandler extends InputHandler { } } + /** + * Returns the fully qualified classname of the standard XML parser for FOP + * to use. + * @return the XML parser classname + */ + public static final String getParserClassName() { + try { + return createParser().getClass().getName(); + } catch (FOPException e) { + return null; + } + } } diff --git a/src/java/org/apache/fop/apps/InputHandler.java b/src/java/org/apache/fop/apps/InputHandler.java index fb060d47d..02d90aa4d 100644 --- a/src/java/org/apache/fop/apps/InputHandler.java +++ b/src/java/org/apache/fop/apps/InputHandler.java @@ -112,11 +112,5 @@ public abstract class InputHandler { } } - /** - * Runs this InputHandler through the Driver. - * @param driver Driver instance to use - * @throws FOPException if processing this InputHandler fails - */ - public abstract void run(Driver driver) throws FOPException; } diff --git a/src/java/org/apache/fop/apps/XSLTInputHandler.java b/src/java/org/apache/fop/apps/XSLTInputHandler.java index d287e0f16..990e683e8 100644 --- a/src/java/org/apache/fop/apps/XSLTInputHandler.java +++ b/src/java/org/apache/fop/apps/XSLTInputHandler.java @@ -191,18 +191,6 @@ public class XSLTInputHandler extends InputHandler { } } - /** - * @see org.apache.fop.apps.InputHandler#run(Driver) - */ - public void run(Driver driver) throws FOPException { - try { - transformer.transform(xmlSource, - new SAXResult(driver.getContentHandler())); - } catch (Exception ex) { - throw new FOPException(ex); - } - } - /** * Sets an XSLT parameter. * @param name the name of the parameter diff --git a/src/java/org/apache/fop/image/XMLImage.java b/src/java/org/apache/fop/image/XMLImage.java index a1a7b8b92..8b97a2cc8 100644 --- a/src/java/org/apache/fop/image/XMLImage.java +++ b/src/java/org/apache/fop/image/XMLImage.java @@ -54,7 +54,7 @@ package org.apache.fop.image; import org.w3c.dom.Document; // FOP -import org.apache.fop.apps.Driver; +import org.apache.fop.apps.FOInputHandler; /** * This is an implementation for XML-based images such as SVG. @@ -86,7 +86,7 @@ public class XMLImage extends AbstractFopImage { * @return the created SAX parser */ public static String getParserName() { - String parserClassName = Driver.getParserClassName(); + String parserClassName = FOInputHandler.getParserClassName(); return parserClassName; } diff --git a/src/java/org/apache/fop/svg/SVGElementMapping.java b/src/java/org/apache/fop/svg/SVGElementMapping.java index 62cb69f20..982737eae 100644 --- a/src/java/org/apache/fop/svg/SVGElementMapping.java +++ b/src/java/org/apache/fop/svg/SVGElementMapping.java @@ -54,7 +54,7 @@ import java.util.HashMap; import org.apache.fop.fo.FONode; import org.apache.fop.fo.ElementMapping; -import org.apache.fop.apps.Driver; +import org.apache.fop.apps.FOInputHandler; import org.apache.batik.util.XMLResourceDescriptor; import org.apache.batik.dom.svg.SVGDOMImplementation; @@ -78,7 +78,7 @@ public class SVGElementMapping extends ElementMapping { // normally the user agent value is used try { XMLResourceDescriptor.setXMLParserClassName( - Driver.getParserClassName()); + FOInputHandler.getParserClassName()); foObjs = new HashMap(); foObjs.put("svg", new SE()); diff --git a/src/java/org/apache/fop/svg/SVGUserAgent.java b/src/java/org/apache/fop/svg/SVGUserAgent.java index 6a63ee4d1..5711df3c0 100644 --- a/src/java/org/apache/fop/svg/SVGUserAgent.java +++ b/src/java/org/apache/fop/svg/SVGUserAgent.java @@ -158,7 +158,7 @@ public class SVGUserAgent extends UserAgentAdapter { * @return the XML parser class name */ public String getXMLParserClassName() { - return org.apache.fop.apps.Driver.getParserClassName(); + return org.apache.fop.apps.FOInputHandler.getParserClassName(); } /**