void initXMLReader ( final File ditaDir , final boolean validate ) throws SAXException { reader = XMLUtils . getXMLReader ( ) ; reader . setFeature ( FEATURE_NAMESPACE , true ) ; reader . setFeature ( FEATURE_NAMESPACE_PREFIX , true ) ; if ( validate ) { reader . setFeature ( FEATURE_VALIDATION , true ) ; try { reader . setFeature ( FEATURE_VALIDATION_SCHEMA , true ) ; } catch ( final SAXNotRecognizedException e ) { // Not Xerces, ignore exception } } else { logger . warn ( MessageUtils . getMessage ( "DOTJ037W" ) . toString ( ) ) ; } if ( gramcache ) { final XMLGrammarPool grammarPool = GrammarPoolManager . getGrammarPool ( ) ; try { reader . setProperty ( "http://apache.org/xml/properties/internal/grammar-pool" , grammarPool ) ; logger . info ( "Using Xerces grammar pool for DTD and schema caching." ) ; } catch ( final NoClassDefFoundError e ) { logger . debug ( "Xerces not available, not using grammar caching" ) ; } catch ( final SAXNotRecognizedException | SAXNotSupportedException e ) { logger . warn ( "Failed to set Xerces grammar pool for parser: " + e . getMessage ( ) ) ; } } CatalogUtils . setDitaDir ( ditaDir ) ; reader . setEntityResolver ( CatalogUtils . getCatalogResolver ( ) ) ; }
Init xml reader used for pipeline parsing .