You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tika.apache.org by go canal <go...@yahoo.com> on 2010/06/29 08:58:25 UTC
parser and Office 2007 files - no exception caught
Hello,
sorry if this is already answered, I am new here.
I am using Tika 0.7, Windows XP. This is my code:
for (File f : files) {
if (isFile(f)) {
try {
input = new FileInputStream(f);
ParseContext context = new ParseContext();
Metadata metadata = new Metadata ();
// -1 to disable write length limit
ContentHandler handler = new BodyContentHandler(-1);
AutoDetectParser parse = new AutoDetectParser();
parse.parse(input, handler, metadata, context);
} catch (FileNotFoundException fnfe) {
System.out.println((fnfe.getMessage());
} catch (TikaException te) {
System.out.println (te.getMessage());
} catch (SAXException se) {
System.out.println (se.getMessage());
} catch (IOException ie) {
tSystem.out.println (ie.getMessage());
} finally {
if (input != null)
try {
input.close();
} catch (IOException ie) {
this.error.append(ie.getMessage()+"\n");
}
}
}
}
I have several questions:
- what is the ParserContext for ? what should I set ?
- I know POI does not support Office 2007, but the above
parse.parse(input, handler, metadata, context);
does not throw any exception and for some reason which I do not know, it does not continue the for loop when it reads in a Office 07 PPT file.
- is there a plan to support Office 07 (sorry, I should ask this in the POI forum, just in case if anyone here knows) thanks,
canal
Re: parser and Office 2007 files - no exception caught
Posted by go canal <go...@yahoo.com>.
thank so you so much for your quick response.
Yes, I tested 0.7 and my own fault, I forgot to add xmlbeans and dom4j. It is now ok for Office 07 files.
thanks,
canal
________________________________
From: Jukka Zitting <ju...@gmail.com>
To: user@tika.apache.org
Sent: Tue, June 29, 2010 3:34:59 PM
Subject: Re: parser and Office 2007 files - no exception caught
Hi,
On Tue, Jun 29, 2010 at 8:58 AM, go canal <go...@yahoo.com> wrote:
> - what is the ParserContext for ? what should I set ?
You can use it to pass extra options and context information to the
parsing process. See my recent presentation [1] for some examples. If
you don't need any extra options, you can just pass in an empty
ParseContext object.
[1] http://www.slideshare.net/jukka/text-and-metadata-extraction-with-apache-tika-4427630
> - I know POI does not support Office 2007
It now does. The POI version used by Tika 0.7 has support for Office 2007.
> - is there a plan to support Office 07
See above. :-)
BR,
Jukka Zitting
Re: parser and Office 2007 files - no exception caught
Posted by Jukka Zitting <ju...@gmail.com>.
Hi,
On Tue, Jun 29, 2010 at 8:58 AM, go canal <go...@yahoo.com> wrote:
> - what is the ParserContext for ? what should I set ?
You can use it to pass extra options and context information to the
parsing process. See my recent presentation [1] for some examples. If
you don't need any extra options, you can just pass in an empty
ParseContext object.
[1] http://www.slideshare.net/jukka/text-and-metadata-extraction-with-apache-tika-4427630
> - I know POI does not support Office 2007
It now does. The POI version used by Tika 0.7 has support for Office 2007.
> - is there a plan to support Office 07
See above. :-)
BR,
Jukka Zitting