/** * Returns the XMLReader specified in this parsing context. If a reader * is not explicitly specified, then one is created using the specified * or the default SAX parser. * * @return XMLReader * @throws TikaException * @see #getSAXParser() * @since Apache Tika 1.13 */ public static XMLReader getXMLReader() throws TikaException { XMLReader reader; try { reader = getSAXParser().getXMLReader(); } catch (SAXException e) { throw new TikaException("Unable to create an XMLReader", e); } reader.setEntityResolver(IGNORING_SAX_ENTITY_RESOLVER); return reader; }
/** * Returns the SAX parser specified in this parsing context. If a parser * is not explicitly specified, then one is created using the specified * or the default SAX parser factory. Consider using * {@link XMLReaderUtils#parseSAX(InputStream, DefaultHandler, ParseContext)} * for more efficient reuse of SAXParsers. * * @see #getSAXParserFactory() * @since Apache Tika 0.8 * @return SAX parser * @throws TikaException if a SAX parser could not be created */ public SAXParser getSAXParser() throws TikaException { SAXParser parser = get(SAXParser.class); if (parser != null) { return parser; } else { return XMLReaderUtils.getSAXParser(); } }
/** * Returns the SAX parser specified in this parsing context. If a parser * is not explicitly specified, then one is created using the specified * or the default SAX parser factory. Consider using * {@link XMLReaderUtils#parseSAX(InputStream, DefaultHandler, ParseContext)} * for more efficient reuse of SAXParsers. * * @see #getSAXParserFactory() * @since Apache Tika 0.8 * @return SAX parser * @throws TikaException if a SAX parser could not be created */ public SAXParser getSAXParser() throws TikaException { SAXParser parser = get(SAXParser.class); if (parser != null) { return parser; } else { return XMLReaderUtils.getSAXParser(); } }
/** * Returns the XMLReader specified in this parsing context. If a reader * is not explicitly specified, then one is created using the specified * or the default SAX parser. * * @return XMLReader * @throws TikaException * @see #getSAXParser() * @since Apache Tika 1.13 */ public static XMLReader getXMLReader() throws TikaException { XMLReader reader; try { reader = getSAXParser().getXMLReader(); } catch (SAXException e) { throw new TikaException("Unable to create an XMLReader", e); } reader.setEntityResolver(IGNORING_SAX_ENTITY_RESOLVER); return reader; }