public class ParseContext extends Object implements Serializable
Constructor and Description |
---|
ParseContext() |
Modifier and Type | Method and Description |
---|---|
<T> T |
get(Class<T> key)
Returns the object in this context that implements the given interface.
|
<T> T |
get(Class<T> key,
T defaultValue)
Returns the object in this context that implements the given interface,
or the given default value if such an object is not found.
|
DocumentBuilder |
getDocumentBuilder()
Returns the DOM builder specified in this parsing context.
|
SAXParser |
getSAXParser()
Returns the SAX parser specified in this parsing context.
|
SAXParserFactory |
getSAXParserFactory()
Returns the SAX parser factory specified in this parsing context.
|
XMLInputFactory |
getXMLInputFactory()
Returns the StAX input factory specified in this parsing context.
|
XMLReader |
getXMLReader()
Returns the XMLReader specified in this parsing context.
|
<T> void |
set(Class<T> key,
T value)
Adds the given value to the context as an implementation of the given
interface.
|
public <T> void set(Class<T> key, T value)
key
- the interface implemented by the given valuevalue
- the value to be added, or null
to removepublic <T> T get(Class<T> key)
key
- the interface implemented by the requested objectnull
if not foundpublic <T> T get(Class<T> key, T defaultValue)
key
- the interface implemented by the requested objectdefaultValue
- value to return if the requested object is not foundpublic XMLReader getXMLReader() throws TikaException
TikaException
getSAXParser()
public SAXParser getSAXParser() throws TikaException
TikaException
- if a SAX parser could not be createdgetSAXParserFactory()
public SAXParserFactory getSAXParserFactory()
secure XML processing
.public DocumentBuilder getDocumentBuilder() throws TikaException
IGNORING_SAX_ENTITY_RESOLVER
,
and it sets the ErrorHandler to null
.TikaException
public XMLInputFactory getXMLInputFactory()
IGNORING_STAX_ENTITY_RESOLVER
.Copyright © 2007–2017 The Apache Software Foundation. All rights reserved.