如何识别ODF文件? [英] How to identify an ODF file?

查看:125
本文介绍了如何识别ODF文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要能够根据文件的内容而不是文件的扩展名来确定给定的文件是ODF文件.

I need to be able to identify that a given file is an ODF file based on the contents of the file, and not on the file's extension.

ODF文件实际上是zip容器中XML文件的集合,这意味着我不能使用该文件的幻数,因为它仅表明它是一个zip文件.

ODF files are really a collection of XML files in a zip container, which means that I cannot use the file's magic number as it will just indicate that it is a zip file.

所以我真正要问的是 ODF容器中是否存在要求的任何文件?容器表示它很可能是ODF文件,而缺少该文件则表明它肯定不是不是 ODF文件.

So what I'm really asking is are there any files that are required to be present in an ODF container? If so the presence of that file in a zip container indicates that it is likely to be an ODF file, and the absence of that file indicates that it definitely is not an ODF file.

推荐答案

为什么不签出 ODF技术规范?列出的mimetype文件可能是一种理想的检查方法(只需在mimetype中查找vnd.oasis.opendocument字符串)即可.

Why not check out the ODF Technical Specification? The mimetype file listed there would probably be an ideal way to check (just look for the vnd.oasis.opendocument string in the mimetype).

这篇关于如何识别ODF文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆