epub格式电子书剖析之二:OPF文件构成
OPF文档是epub电子书的核心文件,且是一个标准的XML文件,依据OPF规范,主要由五个部分组成:
1、<metadata>,元数据信息,由两个子元素组成:
- <dc-metadata>,其元素构成采用dubline core(DC)的15项核心元素,包括:
-
- <title>:题名
- <creator>:责任者
- <subject>:主题词或关键词
- <description>:内容描述
- <contributor>:贡献者或其它次要责任者
- <date>:日期
- <type>:类型
- <format>:格式
- <identifier>:标识符
- <source>:来源
- <language>:语种
- <relation>:相关信息
- <coverage>:履盖范围
- <rights>:权限描述
- <x-metadata>,即扩展元素。如果有些信息在上述元素中无法描述,则在此元素中进行扩展。
2、<menifest>,文件列表,由于列出OEBPS文档及相关的文档,有一个子元素构成,
- <item id="" href="" media-type="">,该元素由三个属性构成:
- id:表示文件的ID号
- href:文件的相对路径
- media-type:文件的媒体类型
- 例如:<item id="page01" href="page01.xhtml" media-type="application/xhtml+xml"/>
- <item id="img000"href="001.png"media-type="image/png" />
- <item id="img001"href="002.jpg"media-type="image/jpeg" />
3、<spine toc="ncx">,脊骨,其主要功能是提供书籍的线性阅读次序。由一个子元素构成:
- <itemref idref="">,由一个属性构成:
-
- idref:即参照menifest列出的ID
- 例如:<itemref idref="page01"/>
4、<guide>,指南,依次列出电子书的特定页面, 例如封面、目录、序言等, 属性值指向文件保存地址。一般情况下,epub电子书可以不用该元素。
5、<tour>,导读。可以根据不同的读者水平或者阅读目的, 按一定次序, 选择电子书中的部分页面组成导读。一般情况下,epub电子书可以不用该元素。
content.opf实例
?
<?xml version=
"1.0"
encoding=
"utf-8"
?>
<!DOCTYPE package PUBLIC
"+//ISBN 978-7-308-05831-5//DTD OEB 1.2 Package//EN"
"http://openebook.org/dtds/oeb-1.2/oebpkg12.dtd"
>
<package unique-identifier=
"bookid"
xmlns:opf=
"http://www.idpf.org/2007/opf"
xmlns=
"http://www.idpf.org/2007/opf"
version=
"2.0"
>
<metadata>
<dc-metadata xmlns:dc=
"http://purl.org/dc/elements/1.1/"
xmlns:dcterms=
"http://purl.org/dc/terms/"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
>
<dc:title>数字档案馆理论与技术研究</dc:title>
<dc:creator>金更达</dc:creator>
<dc:subject>数字档案馆</dc:subject>
<dc:subject>电子文件管理</dc:subject>
<dc:subject>元数据</dc:subject>
<dc:subject>数字化</dc:subject>
<dc:subject>档案化</dc:subject>
<dc:description>当……<dc:description>
<dc:publisher>机械工业出版社</dc:publisher>
<dc:contributor/>
<dc:date>2007-09</dc:date>
<dc:type>普通图书</dc:type>
<dc:format>Text/html(.html,.htm)</dc:format>
<dc:identifier id=
"bookid"
opf:scheme=
"ISBN"
>isbn:978-7-111-04961-6</dc:identifier>
<dc:source/>
<dc:language>chi</dc:language>
<dc:relation/>
<dc:coverage/>
<dc:rights>机械工业出版社版权所有</dc:rights>
</dc-metadata>
<x-metadata/>
</metadata>
<manifest>
<item id=
"ncx"
href=
"toc.ncx"
media-type=
"application/x-dtbncx+xml"
/>
<item id=
"style"
href=
"style.css"
media-type=
"text/css"
/>
<item id=
"cover"
href=
"cover.htm"
media-type=
"text/html"
/>
<item id=
"tableofc"
href=
"toc.xhtml"
media-type=
"application/xhtml+xml"
/>
<item id=
"forword"
href=
"forword.xhtml"
media-type=
"application/xhtml+xml"
/>
<item id=
"chap01"
href=
"chap01.xhtml"
media-type=
"application/xhtml+xml"
/>
<item id=
"chap02"
href=
"chap02.xhtml"
media-type=
"application/xhtml+xml"
/>
<item id=
"chap03"
href=
"chap03.xhtml"
media-type=
"application/xhtml+xml"
/>
<item id=
"chap04"
href=
"chap04.xhtml"
media-type=
"application/xhtml+xml"
/>
<item id=
"chap05"
href=
"chap05.xhtml"
media-type=
"application/xhtml+xml"
/>
<item id=
"chap06"
href=
"chap06.xhtml"
media-type=
"application/xhtml+xml"
/>
<item id=
"chap07"
href=
"chap07.xhtml"
media-type=
"application/xhtml+xml"
/>
<item id=
"chap08"
href=
"chap08.xhtml"
media-type=
"application/xhtml+xml"
/>
<item id=
"chap09"
href=
"chap09.xhtml"
media-type=
"application/xhtml+xml"
/>
<item id=
"chap10"
href=
"chap10.xhtml"
media-type=
"application/xhtml+xml"
/>
<item id=
"reference"
href=
"reference.xhtml"
media-type=
"application/xhtml+xml"
/>
</manifest>
<spine toc=
"ncx"
>
<itemref idref=
"cover"
/>
<itemref idref=
"tableofc"
/>
<itemref idref=
"forword"
/>
<itemref idref=
"chap01"
/>
<itemref idref=
"chap02"
/>
<itemref idref=
"chap03"
/>
<itemref idref=
"chap04"
/>
<itemref idref=
"chap05"
/>
<itemref idref=
"chap06"
/>
<itemref idref=
"chap07"
/>
<itemref idref=
"chap08"
/>
<itemref idref=
"chap09"
/>
<itemref idref=
"chap10"
/>
<itemref idref=
"reference"
/>
</spine>
<guide/>
</package> http://www.cnblogs.com/linlf03/archive/2011/12/13/2285983.html
|