`

EPUB 2.0 OPF

 
阅读更多
OPF Package Document

  是一个格式良好的 XML 1.0 文档;

  UTF-8 或 UTF-16 编码;

  可以通过 Appendix A 中的 XML Schema 验证;

  可以由一个或者多个 XML 文件组成,但是只有一个文件可以以 .opf 作为扩展名;

  OPF Package Document 的 media-type 是 application/oebps-package+xml。

OPF Publication

  包含一个 OPF Package Document;

  带 .opf 扩展名的那个 Package Document 必须作为 Package Document 的根文件(root file);

  包含且只包含一个 manifest 元素,该元素中包含许多 item 元素,每个元素对应 OPS Publication 中的一个文件,但 OPF Package Document 文件本身不包含其中;

  spine 元素中列出的每个文件都必须遵守 OPS Content Document requirements

  每个 item 元素指明了文件所属的 MIME mdeia type,OPS Core Media Types:http://idpf.org/epub/20/spec/OPS_2.0.1_draft.htm#Section1.3.7

  必须包含一个 UTF-8 或者 UTF-16 编码的 NCX 文件;

  metadata 元素中必须包含至少1个 identifier, title 和 language 元素;

  根元素 package 的 unique-identifier 属性必须是正确的某个 identifier 元素的 id;

  任何 creator 和 contributor 元素的 OPF role 属性的扩展值必须取自 MARC Relator Code 列表或者以 oth. 开头;

  任何 guide 元素的 type 属性的扩展值必须以 other. 开头;

  package 元素的 version 属性必须是 2.0;

  package 元素的 namespace 必须是:http://www.idpf.org/2007/opf,而且必须声明在 OPF Package Document 的根部;

  (fallback? 是啥)

Dublin Core Metadata

  metadata 中必须包含至少一个 identifier, title 和 language 元素,并且至少有一个 identifer 被 package 的 unique-identifier 引用;

  Dublin Core 没有为 Metadata 定义任何属性,In the above example, the specification of the OPF namespace on the metadata element is present to resolve the scheme and role attributes used in the identifier and creator elements, respectively.

  规范没有定义如何选择最恰当的那个 title 元素作为标题显示,你可以根据可用的字体、title 元素的 xml:lang 属性或者其它方法试探。如果没有这样的一个算法,阅读系统可以把第一个 title 元素,或者所有的 title 元素当作最适当的标题;

  creator 元素用于标示出版物的主要创建者或者作者,其它次要的贡献者使用 contributor 元素。每个作者使用一个 creator 元素。定义的顺序即显示的顺序。opf:file-as 属性是格式对机器友好的姓名,如:

<dc:creator opf:file-as="King, Martin Luther Jr." opf:role="aut">
        Rev. Dr. Martin Luther King Jr.
</dc:creator>

  creator 的显示和 title 一样,但是在没有选择算法的情况下,阅读系统要显示出所有的 creator 姓名,使用适当的空格和 / 或者标点。

  subject, description, publisher 元素,没有具体的规范;

  contributor 次要贡献者,阅读系统可以选择不显示或显示 contributor 信息。跟 creator 一样,contributor 也有 role 和 file-as 属性。其中 role 属性必须是小写字母。

  date 元素的格式定义:http://www.w3.org/TR/NOTE-datetime。如果不带时间信息,格式必须为:YYYY-MM-DD,其中月份和具体的日期是可选的。date 元素有一个可选的 OPF event 属性,具体的值没有在规范中作出限制,可能出现的值有:creation, publication, 和 modification.

  type, format 没有具体的规范,最佳实践是从某一个受约束的词汇表中选值,例如 MIME media types;

  identifier 元素有一个可选的 OPF schema 属性,用于给生成 identifier 的系统或者权威机构命名,例如:"ISBN", "DOI"。

Spine

  itemref 的 linear 属性默认为 "yes",表示该内容为 EPUB 当中的主要(primary)内容,为 "no" 时表示该内容为次要(auxiliary)内容。It is important that the publication author include some kind of internal reference, such as a hypertext link, to any OPS Content Document that is declared to be auxiliary; it is recommended that references be added to NCX for all auxiliary content. 至少有1个 itemref 必须声明为 primary。Reading Systems may use "next-page" style functionality when moving from one primary OPS Content Document to the next primary one in spine. 例子:

<manifest>
     <item id="intro"
           href="intro.html"
           media-type="application/xhtml+xml" />
     <item id="c1"
           href="chap1.html"
           media-type="application/xhtml+xml" />
     <item id="c1-answerkey"
           href="chap1-answerkey.html"
           media-type="application/xhtml+xml" />
     <item id="c2"
           href="chap2.dtb"
           media-type="application/x-dtbook+xml" />
     <item id="c2-answerkey"
           href="chap2-answerkey.html"
           media-type="application/xhtml+xml" />
     <item id="c3"
           href="chap3.html"
           media-type="application/xhtml+xml" />
     <item id="c3-answerkey"
           href="chap3-answerkey.html"
           media-type="application/xhtml+xml" />
     <item id="note"
           href="note.html"
           media-type="application/xhtml+xml" />
     <item id="f1"
           href="fig1.jpg"
           media-type="image/jpeg" />
     <item id="f2"
           href="fig2.jpg"
           media-type="image/jpeg" />
     <item id="f3"
           href="fig3.jpg"
           media-type="image/jpeg" />
     <item id="ncx"
           href="toc.ncx"
           media-type="application/x-dtbncx+xml" />
</manifest>
<spine toc="ncx">
     <itemref idref="intro" />
     <itemref idref="c1" />
     <itemref idref="c1-answerkey" linear="no" />
     <itemref idref="c2" />
     <itemref idref="c2-answerkey" linear="no" />
     <itemref idref="c3" />
     <itemref idref="c3-answerkey" linear="no" />
     <itemref idref="note" linear="no" />
</spine>


  spine 元素必须有一个 toc 属性,值为 NCX document 在 manifest 中声明的 id 值。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics