public class DelegatingParser extends AbstractParser
Parser
class as
the key.Constructor and Description |
---|
DelegatingParser() |
Modifier and Type | Method and Description |
---|---|
protected Parser |
getDelegateParser(ParseContext context)
Returns the parser instance to which parsing tasks should be delegated.
|
Set<MediaType> |
getSupportedTypes(ParseContext context)
Returns the set of media types supported by this parser when used
with the given parse context.
|
void |
parse(InputStream stream,
ContentHandler handler,
Metadata metadata,
ParseContext context)
Looks up the delegate parser from the parsing context and
delegates the parse operation to it.
|
parse
protected Parser getDelegateParser(ParseContext context)
EmptyParser
instance as a fallback.
Subclasses can override this method to implement alternative delegation
strategies.context
- parse contextpublic Set<MediaType> getSupportedTypes(ParseContext context)
Parser
context
- parse contextpublic void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws SAXException, IOException, TikaException
Subclasses should override this method to parse the top level structure of the given document stream. Parsed sub-streams can be passed to this base class method to be parsed by the configured delegate parser.
stream
- the document stream (input)handler
- handler for the XHTML SAX events (output)metadata
- document metadata (input and output)context
- parse contextSAXException
- if the SAX events could not be processedIOException
- if the document stream could not be readTikaException
- if the document could not be parsedCopyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.