tika-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TIKA-288) Support override parsers in AutoDetectParser
Date Fri, 20 May 2011 22:50:47 GMT

    [ https://issues.apache.org/jira/browse/TIKA-288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13037136#comment-13037136
] 

Jukka Zitting commented on TIKA-288:
------------------------------------

How about the following?

{code}
AutoDetectParser parser = new AutoDetectParser();
Parser html = parser.getParsers().get(MediaType.text("html"));
Parser custom = new MyCustomHtmlParser();
parser = new AutoDetectParser(
    parser.getDetector(),
    parser,
    ParserDecorator.withTypes(custom, html.getSupportedTypes(context)));
{code}

It's a bit convoluted, but should cover the needs of your use case.

> Support override parsers in AutoDetectParser
> --------------------------------------------
>
>                 Key: TIKA-288
>                 URL: https://issues.apache.org/jira/browse/TIKA-288
>             Project: Tika
>          Issue Type: Improvement
>          Components: parser
>    Affects Versions: 0.4
>            Reporter: Ken Krugler
>            Priority: Minor
>
> In some situations, being able to specify an alternative parser is useful even when the
general parser framework/full set of parsers is desired.
> For example, when processing HTML documents the current HtmlParser doesn't pass through
all of the tags that a vertical crawler might want.
> I'm proposing an alternative constructor, something like:
> public AutoDetectParser(Map<class, Parser>)
> where class would be the class of the standard Tika parser, and Parser is the override.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message