Class ParseContext

java.lang.Object
org.apache.tika.parser.ParseContext
All Implemented Interfaces:
Serializable

@Deprecated(since="2026-04-30") public class ParseContext extends Object implements Serializable
Deprecated.
This version of the Apache Tika library is deprecated. Use your own version of Apache Tika.
Parse context. Used to pass context information to Tika parsers.
Since:
Apache Tika 0.5
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    get(Class<T> key)
    Deprecated.
    Returns the object in this context that implements the given interface.
    <T> T
    get(Class<T> key, T defaultValue)
    Deprecated.
    Returns the object in this context that implements the given interface, or the given default value if such an object is not found.
    Deprecated.
    Returns the DOM builder specified in this parsing context.
    Deprecated.
    Returns the SAX parser specified in this parsing context.
    Deprecated.
    Returns the SAX parser factory specified in this parsing context.
    Deprecated.
    Returns the transformer specified in this parsing context.
    Deprecated.
    Returns the StAX input factory specified in this parsing context.
    Deprecated.
    Returns the XMLReader specified in this parsing context.
    <T> void
    set(Class<T> key, T value)
    Deprecated.
    Adds the given value to the context as an implementation of the given interface.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ParseContext

      public ParseContext()
      Deprecated.
  • Method Details

    • set

      public <T> void set(Class<T> key, T value)
      Deprecated.
      Adds the given value to the context as an implementation of the given interface.
      Parameters:
      key - the interface implemented by the given value
      value - the value to be added, or null to remove
    • get

      public <T> T get(Class<T> key)
      Deprecated.
      Returns the object in this context that implements the given interface.
      Parameters:
      key - the interface implemented by the requested object
      Returns:
      the object that implements the given interface, or null if not found
    • get

      public <T> T get(Class<T> key, T defaultValue)
      Deprecated.
      Returns the object in this context that implements the given interface, or the given default value if such an object is not found.
      Parameters:
      key - the interface implemented by the requested object
      defaultValue - value to return if the requested object is not found
      Returns:
      the object that implements the given interface, or the given default value if not found
    • getXMLReader

      public XMLReader getXMLReader() throws TikaException
      Deprecated.
      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.
      Returns:
      XMLReader
      Throws:
      TikaException
      Since:
      Apache Tika 1.13
      See Also:
    • getSAXParser

      public SAXParser getSAXParser() throws TikaException
      Deprecated.
      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 XMLReaderUtils.parseSAX(InputStream, DefaultHandler, ParseContext) for more efficient reuse of SAXParsers.
      Returns:
      SAX parser
      Throws:
      TikaException - if a SAX parser could not be created
      Since:
      Apache Tika 0.8
      See Also:
    • getSAXParserFactory

      public SAXParserFactory getSAXParserFactory()
      Deprecated.
      Returns the SAX parser factory specified in this parsing context. If a factory is not explicitly specified, then a default factory instance is created and returned. The default factory instance is configured to be namespace-aware, not validating, and to use secure XML processing.
      Returns:
      SAX parser factory
      Since:
      Apache Tika 0.8
    • getDocumentBuilder

      public DocumentBuilder getDocumentBuilder() throws TikaException
      Deprecated.
      Returns the DOM builder specified in this parsing context. If a builder is not explicitly specified, then a builder instance is created and returned. The builder instance is configured to apply an XMLReaderUtils.IGNORING_SAX_ENTITY_RESOLVER, and it sets the ErrorHandler to null. Consider using XMLReaderUtils.buildDOM(InputStream, ParseContext) instead for more efficient reuse of document builders.
      Returns:
      DOM Builder
      Throws:
      TikaException
      Since:
      Apache Tika 1.13
    • getXMLInputFactory

      public XMLInputFactory getXMLInputFactory()
      Deprecated.
      Returns the StAX input factory specified in this parsing context. If a factory is not explicitly specified, then a default factory instance is created and returned. The default factory instance is configured to be namespace-aware and to apply reasonable security using the XMLReaderUtils.IGNORING_STAX_ENTITY_RESOLVER.
      Returns:
      StAX input factory
      Since:
      Apache Tika 1.13
    • getTransformer

      public Transformer getTransformer() throws TikaException
      Deprecated.
      Returns the transformer specified in this parsing context. If a transformer is not explicitly specified, then a default transformer instance is created and returned. The default transformer instance is configured to to use secure XML processing.
      Returns:
      Transformer
      Throws:
      TikaException - when the transformer can not be created
      Since:
      Apache Tika 1.17