public class ParseContext
extends java.lang.Object
implements java.io.Serializable
| Constructor and Description |
|---|
ParseContext() |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
get(java.lang.Class<T> key)
Returns the object in this context that implements the given interface.
|
<T> T |
get(java.lang.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.
|
javax.xml.parsers.DocumentBuilder |
getDocumentBuilder()
Returns the DOM builder specified in this parsing context.
|
javax.xml.parsers.SAXParser |
getSAXParser()
Returns the SAX parser specified in this parsing context.
|
javax.xml.parsers.SAXParserFactory |
getSAXParserFactory()
Returns the SAX parser factory specified in this parsing context.
|
javax.xml.transform.Transformer |
getTransformer()
Returns the transformer specified in this parsing context.
|
javax.xml.stream.XMLInputFactory |
getXMLInputFactory()
Returns the StAX input factory specified in this parsing context.
|
org.xml.sax.XMLReader |
getXMLReader()
Returns the XMLReader specified in this parsing context.
|
<T> void |
set(java.lang.Class<T> key,
T value)
Adds the given value to the context as an implementation of the given
interface.
|
public <T> void set(java.lang.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(java.lang.Class<T> key)
key - the interface implemented by the requested objectnull if not foundpublic <T> T get(java.lang.Class<T> key,
T defaultValue)
key - the interface implemented by the requested objectdefaultValue - value to return if the requested object is not foundpublic org.xml.sax.XMLReader getXMLReader()
throws TikaException
TikaExceptiongetSAXParser()public javax.xml.parsers.SAXParser getSAXParser()
throws TikaException
XMLReaderUtils.parseSAX(InputStream, DefaultHandler, ParseContext)
for more efficient reuse of SAXParsers.TikaException - if a SAX parser could not be createdgetSAXParserFactory()public javax.xml.parsers.SAXParserFactory getSAXParserFactory()
secure XML processing.public javax.xml.parsers.DocumentBuilder getDocumentBuilder()
throws TikaException
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.TikaExceptionpublic javax.xml.stream.XMLInputFactory getXMLInputFactory()
XMLReaderUtils.IGNORING_STAX_ENTITY_RESOLVER.public javax.xml.transform.Transformer getTransformer()
throws TikaException
secure XML processing.TikaException - when the transformer can not be createdCopyright © 2010 - 2023 Adobe. All Rights Reserved