我试图用Apache Tika解析iWorksDoc。但是我没有得到解析的内容,而是从内容处理程序中获取了一些其他输出。我已使用的代码段以及得到的输出添加在下面。
private void parseFile(File file) {
try{
File file = new File("/home/user/tika/samples/budget.numbers");
FileInputStream inputStream = new FileInputStream(file);
ParseContext context = new ParseContext();
BodyContentHandler bodyHandler = new BodyContentHandler(-1);
Parser parser=new AutoDetectParser();
parser.parse(inputStream, bodyHandler, new Metadata(), context);
System.out.println("Contents of the file :"+bodyHandler.toString());
}
catch(IOException | SAXException | TikaException e){
e.printStackTrace();
}
}
输出 :-
Contents of the file :
Index/Document.iwa
Index/ViewState.iwa
Index/CalculationEngine.iwa
Index/Tables/HeaderStorageBucket-2.iwa
Index/Tables/Tile.iwa
Index/Metadata.iwa
Metadata/Properties.plist
我能够使用Detector api正确检测文件类型。但是没有从文档中获取有用的内容。请帮忙!
Tika应该能够解析Numbers文档。如果您可以共享文档,请将其发布到我们的Jira。当我看解析器时,我们可以更强大地处理名称空间,这可能是问题所在,但是没有文档我无法分辨。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句