[ 
https://issues.apache.org/jira/browse/TIKA-309?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Yuan-Fang Li reopened TIKA-309:
-------------------------------


Hi Chris,

Thanks a lot for the fix. However, I have to reopen the ticket due to some 
problems with InputStream, and some other issues.

1. In your comment you suggested that I do the following (pseudo code):

AutoDetectParser parser = new AutoDetectParser(); 
parser.setDetector(new NameDetector()); 
Metadata met = new Metadata(); 
met.set(Metadata.RESOURCE_NAME_KEY, "name or url of your file"); 
parser.parse(InputStream stream, some ContentHandler, met); 

Since NameDetector takes a map as the parameter for the constructor, I have to 
do the following:

parser.setDetector(new NameDetector(new HashMap<Pattern, MediaType>()));

Doing so invalidates my tests because the map in NameDetector is empty,  the 
mime type returned will always be "application/octet-stream". Is there another 
way to initialize the NameDetector?

2. The detection for the 2 URLs works perfectly now based on your suggestion 
(not adding NameDetector to the parser but adding 
met.set(Metadata.RESOURCE_NAME_KEY, "name or url of your file"); ). However, if 
my input is an input stream, the test still fails since the parser doesn't have 
the hint from file/URL names.

> Mime type application/rdf+xml not correctly detected
> ----------------------------------------------------
>
>                 Key: TIKA-309
>                 URL: https://issues.apache.org/jira/browse/TIKA-309
>             Project: Tika
>          Issue Type: Bug
>          Components: mime
>    Affects Versions: 0.5
>            Reporter: Yuan-Fang Li
>            Assignee: Chris A. Mattmann
>            Priority: Minor
>             Fix For: 0.5
>
>
> Mime type detector using AutoDetectParser and Metadata returns 
> "application/xml" for the URL http://www.w3.org/2002/07/owl#, where it should 
> be "application/rdf+xml". The correct mime type is also suggested here: 
> http://www.w3.org/TR/owl-ref/#MIMEType.
> P.S., Tika was downloaded from svn and built with Maven last week.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to