[FOray-commit] SF.net SVN: foray: [7782] trunk/foray/foray-core/src/java/org/foray/core
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2006-07-15 22:29:13
|
Revision: 7782 Author: victormote Date: 2006-07-15 15:29:05 -0700 (Sat, 15 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7782&view=rev Log Message: ----------- Minor refactoring and cleanup. Modified Paths: -------------- trunk/foray/foray-core/src/java/org/foray/core/FOInputHandler.java trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java Modified: trunk/foray/foray-core/src/java/org/foray/core/FOInputHandler.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/FOInputHandler.java 2006-07-15 21:08:38 UTC (rev 7781) +++ trunk/foray/foray-core/src/java/org/foray/core/FOInputHandler.java 2006-07-15 22:29:05 UTC (rev 7782) @@ -57,7 +57,8 @@ if (fofile != null) { return super.fileInputSource(fofile); } - return super.urlInputSource(foURL); + InputSource inputSource = new InputSource(foURL.openStream()); + return inputSource; } public XMLReader getParser() throws FOrayException { Modified: trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java 2006-07-15 21:08:38 UTC (rev 7781) +++ trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java 2006-07-15 22:29:05 UTC (rev 7782) @@ -37,7 +37,6 @@ import java.io.File; import java.io.IOException; import java.net.MalformedURLException; -import java.net.URL; import javax.xml.parsers.SAXParserFactory; @@ -45,16 +44,13 @@ Log logger; - public abstract InputSource getInputSource() throws IOException ; - public abstract XMLReader getParser() throws FOrayException; - public InputHandler(Log logger) { this.logger = logger; } - public static InputSource urlInputSource(URL url) throws IOException { - return new InputSource(url.openStream()); - } +// public static InputSource urlInputSource(URL url) throws IOException { +// return new InputSource(url.openStream()); +// } /** * create an InputSource from a File @@ -81,25 +77,38 @@ } /** - * creates a SAX parser - * - * @return the created SAX parser + * Creates a SAX parser. + * @return The newly-created SAX parser. */ protected XMLReader createParser() throws FOrayException { + SAXParserFactory spf = javax.xml.parsers.SAXParserFactory.newInstance(); + spf.setNamespaceAware(true); + XMLReader xmlReader = null; try { - SAXParserFactory spf - = javax.xml.parsers.SAXParserFactory.newInstance(); - spf.setNamespaceAware(true); - XMLReader xmlReader = spf.newSAXParser().getXMLReader(); - this.logger.info("FO Parsing: Using " - + xmlReader.getClass().getName() + " as SAX2 Parser."); - return xmlReader; + xmlReader = spf.newSAXParser().getXMLReader(); } catch (javax.xml.parsers.ParserConfigurationException e) { throw new FOrayException(e); } catch (SAXException e) { throw new FOrayException(e); } + if (this.logger.isDebugEnabled()) { + this.logger.debug("FO Parsing: Using " + + xmlReader.getClass().getName() + " as SAX2 Parser."); + } + return xmlReader; } + /** + * Provides the SAX InputSource. + * @return The SAX InputSource for this handler. + * @throws IOException + */ + public abstract InputSource getInputSource() throws IOException ; + + /** + * Provides the SAX parser for the SAX InputSource. + * @return The SAX parser for the SAX InputSource. + */ + public abstract XMLReader getParser() throws FOrayException; + } - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |