private void init ( ) { boolean success = false ; // If JAXP is prefered (comes with Sun JVM 1.4.0 and higher) if ( ! success ) { try { javax . xml . parsers . SAXParserFactory spf = javax . xml . parsers . SAXParserFactory . newInstance ( ) ; spf . setNamespaceAware ( true ) ; javax . xml . parsers . SAXParser saxParser = spf . newSAXParser ( ) ; parser = saxParser . getXMLReader ( ) ; logger . info ( "Using JAXP/SAX XML parser." ) ; success = true ; } catch ( ParserConfigurationException | SAXException e ) { logger . warn ( "Could not instantiate JAXP/SAX XML reader!" ) ; logger . debug ( e ) ; } } // Aelfred is first alternative. if ( ! success ) { try { parser = ( XMLReader ) this . getClass ( ) . getClassLoader ( ) . loadClass ( "gnu.xml.aelfred2.XmlReader" ) . newInstance ( ) ; logger . info ( "Using Aelfred2 XML parser." ) ; success = true ; } catch ( ClassNotFoundException | InstantiationException | IllegalAccessException e ) { logger . warn ( "Could not instantiate Aelfred2 XML reader!" ) ; logger . debug ( e ) ; } } // Xerces is second alternative if ( ! success ) { try { parser = ( XMLReader ) this . getClass ( ) . getClassLoader ( ) . loadClass ( "org.apache.xerces.parsers.SAXParser" ) . newInstance ( ) ; logger . info ( "Using Xerces XML parser." ) ; success = true ; } catch ( ClassNotFoundException | InstantiationException | IllegalAccessException e ) { logger . warn ( "Could not instantiate Xerces XML reader!" ) ; logger . debug ( e ) ; } } if ( ! success ) { logger . error ( "Could not instantiate any XML parser!" ) ; } }
Initializes this reader .