+++ /dev/null
-// SAX parser factory.\r
-// No warranty; no copyright -- use this as you will.\r
-// $Id: ParserFactory.java,v 1.1 2000/10/02 02:43:20 sboag Exp $\r
-\r
-package org.xml.sax.helpers;\r
-\r
-import java.lang.ClassNotFoundException;\r
-import java.lang.IllegalAccessException;\r
-import java.lang.InstantiationException;\r
-import java.lang.SecurityException;\r
-import java.lang.ClassCastException;\r
-\r
-import org.xml.sax.Parser;\r
-\r
-\r
-/**\r
- * Java-specific class for dynamically loading SAX parsers.\r
- *\r
- * <blockquote>\r
- * <em>This module, both source code and documentation, is in the\r
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
- * </blockquote>\r
- *\r
- * <p><strong>Note:</strong> This class is designed to work with the now-deprecated\r
- * SAX1 {@link org.xml.sax.Parser Parser} class. SAX2 applications should use\r
- * {@link org.xml.sax.helpers.XMLReaderFactory XMLReaderFactory} instead.</p>\r
- *\r
- * <p>ParserFactory is not part of the platform-independent definition\r
- * of SAX; it is an additional convenience class designed\r
- * specifically for Java XML application writers. SAX applications\r
- * can use the static methods in this class to allocate a SAX parser\r
- * dynamically at run-time based either on the value of the\r
- * `org.xml.sax.parser' system property or on a string containing the class\r
- * name.</p>\r
- *\r
- * <p>Note that the application still requires an XML parser that\r
- * implements SAX1.</p>\r
- *\r
- * @deprecated This class works with the deprecated\r
- * {@link org.xml.sax.Parser Parser}\r
- * interface.\r
- * @since SAX 1.0\r
- * @author David Megginson, \r
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
- * @version 2.0\r
- * @see org.xml.sax.Parser\r
- * @see java.lang.Class\r
- */\r
-public class ParserFactory {\r
- \r
- \r
- /**\r
- * Private null constructor.\r
- */\r
- private ParserFactory ()\r
- {\r
- }\r
- \r
- \r
- /**\r
- * Create a new SAX parser using the `org.xml.sax.parser' system property.\r
- *\r
- * <p>The named class must exist and must implement the\r
- * {@link org.xml.sax.Parser Parser} interface.</p>\r
- *\r
- * @exception java.lang.NullPointerException There is no value\r
- * for the `org.xml.sax.parser' system property.\r
- * @exception java.lang.ClassNotFoundException The SAX parser\r
- * class was not found (check your CLASSPATH).\r
- * @exception IllegalAccessException The SAX parser class was\r
- * found, but you do not have permission to load\r
- * it.\r
- * @exception InstantiationException The SAX parser class was\r
- * found but could not be instantiated.\r
- * @exception java.lang.ClassCastException The SAX parser class\r
- * was found and instantiated, but does not implement\r
- * org.xml.sax.Parser.\r
- * @see #makeParser(java.lang.String)\r
- * @see org.xml.sax.Parser\r
- */\r
- public static Parser makeParser ()\r
- throws ClassNotFoundException,\r
- IllegalAccessException, \r
- InstantiationException,\r
- NullPointerException,\r
- ClassCastException\r
- {\r
- String className = System.getProperty("org.xml.sax.parser");\r
- if (className == null) {\r
- throw new NullPointerException("No value for sax.parser property");\r
- } else {\r
- return makeParser(className);\r
- }\r
- }\r
- \r
- \r
- /**\r
- * Create a new SAX parser object using the class name provided.\r
- *\r
- * <p>The named class must exist and must implement the\r
- * {@link org.xml.sax.Parser Parser} interface.</p>\r
- *\r
- * @param className A string containing the name of the\r
- * SAX parser class.\r
- * @exception java.lang.ClassNotFoundException The SAX parser\r
- * class was not found (check your CLASSPATH).\r
- * @exception IllegalAccessException The SAX parser class was\r
- * found, but you do not have permission to load\r
- * it.\r
- * @exception InstantiationException The SAX parser class was\r
- * found but could not be instantiated.\r
- * @exception java.lang.ClassCastException The SAX parser class\r
- * was found and instantiated, but does not implement\r
- * org.xml.sax.Parser.\r
- * @see #makeParser()\r
- * @see org.xml.sax.Parser\r
- */\r
- public static Parser makeParser (String className)\r
- throws ClassNotFoundException,\r
- IllegalAccessException, \r
- InstantiationException,\r
- ClassCastException\r
- {\r
- return (Parser)(Class.forName(className).newInstance());\r
- }\r
- \r
-}\r
-\r
-// end of ParserFactory.java\r