Class XMLReaderFactory


  • public class XMLReaderFactory
    extends java.lang.Object
    Factory class for creating an XMLReader. This factory tries to use the system property 'org.xml.sax.driver', if that fails it falls back on javax.xml.sax.parsers.SAXParserFactory. If the SAXParserFactory class can not be found (this can happen when using a Java 1.3 or older), or the initialization using SAXParserFactory fails otherwise, the factory falls back on the Xerces 2 SAX Parser.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String XERCES_SAXPARSER  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      protected static org.xml.sax.XMLReader _createXMLReader​(java.lang.String name)  
      static org.xml.sax.XMLReader createXMLReader()
      creates an org.xml.sax.XMLReader object.
      static org.xml.sax.XMLReader createXMLReader​(java.lang.String name)
      Creates an org.xml.sax.XMLReader object using the supplied name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • XERCES_SAXPARSER

        public static final java.lang.String XERCES_SAXPARSER
        See Also:
        Constant Field Values
    • Constructor Detail

      • XMLReaderFactory

        public XMLReaderFactory()
    • Method Detail

      • createXMLReader

        public static org.xml.sax.XMLReader createXMLReader()
                                                     throws org.xml.sax.SAXException
        creates an org.xml.sax.XMLReader object. The method first tries to create the XMLReader object specified in the 'org.xml.sax.driver' system property. If that fails, it tries to use java.xml.parsers.SAXParserFactory. If that also fails, it tries to initialize the Xerces 2 SAX parser. If that also fails, a SAXException is thrown.
        Returns:
        an XMLReader
        Throws:
        org.xml.sax.SAXException - when no default XMLReader class can be found or instantiated.
      • createXMLReader

        public static org.xml.sax.XMLReader createXMLReader​(java.lang.String name)
                                                     throws org.xml.sax.SAXException
        Creates an org.xml.sax.XMLReader object using the supplied name.
        Returns:
        an XMLReader
        Throws:
        org.xml.sax.SAXException - when the supplied XMLReader class name can not be found or instantiated.
      • _createXMLReader

        protected static org.xml.sax.XMLReader _createXMLReader​(java.lang.String name)
                                                         throws java.lang.ClassNotFoundException,
                                                                java.lang.ClassCastException,
                                                                java.lang.InstantiationException,
                                                                java.lang.IllegalAccessException
        Throws:
        java.lang.ClassNotFoundException
        java.lang.ClassCastException
        java.lang.InstantiationException
        java.lang.IllegalAccessException