--ZIP Container-- mimetype META-INF/ container.xml OPS/ book.opf chapter1.xhtml ch1-pic.png css/ style.css myfont.otf
epub是一种电子图书标准(文件后缀名为.epub)。
epub是一个自由的开放标准,文件本质上就是xhtml经过zip归档压缩所得,在文档中采用几个xml来标示文件的结构。
epub 的文件内部结构如下图所示:
几个重要的xml文件:
META-INF/ container.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
<rootfiles>
<rootfile full-path="OPS/fb.opf" media-type="application/oebps-package+xml"/>
</rootfiles>
</container>
<?xml version="1.0" encoding="UTF-8" ?> <container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> <rootfiles> <rootfile full-path="OPS/fb.opf" media-type="application/oebps-package+xml"/> </rootfiles> </container>
在此xml中rootfile节点的full-path属性的值为下一个重要xml文件fb.opf的路径
fb.opf:
<?xml version="1.0" encoding="UTF-8" ?> <package version="2.0" unique-identifier="PrimaryID" mlns="http://www.idpf.org/2007/opf"> <metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf"> <dc:title>福尔摩斯探案全集</dc:title> <dc:identifier opf:scheme="ISBN"></dc:identifier> <dc:language>简体中文</dc:language> <dc:creator>柯南道尔</dc:creator> <dc:publisher>epub掌上书苑</dc:publisher> <dc:description>《福尔摩斯探案全集》可谓是开辟了侦探小说历史“黄金时代”的不朽经典,一百多年来被译成57种文字,风靡全世界,是历史上最受读者推崇,绝对不能错过的侦探小说。《福尔摩斯探案全集》结构严谨,环环紧扣,故事情节惊险离奇,引人入胜,被推理迷们称为推理小说中的《圣经》,是每一个推理迷必备的案头书籍。从《血字的研究》诞生到现在的一百多年间,福尔摩斯打遍天下无敌手,影响力早已越过推理一隅,成为人们心中神探的代名词。福尔摩斯仿佛真的成为了生活在我们身边的有血有肉的活人,许多人都在寻找福尔摩斯,并坚信确实有这样一位伟大侦探存在。即便是没有看过侦探小说的人,也知道福尔摩斯这号人物!</dc:description> <dc:coverage></dc:coverage> <dc:source>http://www.cnepub.com</dc:source> <dc:date>2010-05-12</dc:date> <dc:rights>本电子书由epubBuilder制作生成,欢迎访问http://www.cnepub.com浏览海量电子书。</dc:rights> <dc:subject>侦探·悬疑</dc:subject> <dc:contributor></dc:contributor> <dc:type>[type]</dc:type> <dc:format></dc:format> <dc:relation></dc:relation> <dc:builder>epubBuilder</dc:builder> <dc:builder_version>2.5.4.30</dc:builder_version> <meta name="cover" content="cover-image"/> </metadata> <manifest> <!-- Content Documents --> <item id="main-css" href="css/main.css" media-type="text/css"/> <item id="coverpage" href="coverpage.html" media-type="application/xhtml+xml"/> <item id="chapter1" href="chapter1.html" media-type="application/xhtml+xml"/> ....... <item id="chapter9" href="chapter9.html" media-type="application/xhtml+xml"/> <item id="ncx" href="fb.ncx" media-type="application/x-dtbncx+xml"/> <item id="css" href="css/main.css" media-type="text/css"/> <item id="cover-image" href="images/cover.jpg" media-type="image/jpeg"/> </manifest> <spine toc="ncx"> <itemref idref="coverpage" linear="yes"/> <itemref idref="chapter1" linear="yes"/> ...... <itemref idref="chapter9" linear="yes"/> </spine> <guide> <reference type="cover" title="封面" href="coverpage.html"/> <reference type="text" title="1-血字的研究" href="chapter1.html"/> ...... <reference type="text" title="9-最后致意" href="chapter9.html"/> </guide> </package>
*.OPF文件的根节点package下有4个子节点:metadata,manifest,spine,guide.
-
metadata:保存文档的一些基本信息。
-
manifest: 指示epub包中所有除自己这个文件与mimetype外的所有文件的位置。
-
spine: 列出xhtml文档的读取顺序。
-
guide:列出epub文件的大体结构,其中的reference节点的href属性值在manifest中都存在。
-
在manifest中我们可以发现一个*.ncx文件,他没啥子内容,wiki上描述他的标准时为有声电子书定制的。
本文内容大多来源于 http://en.wikipedia.org/wiki/EPUB#File_format,该文全当对他的简单总结。
ps:在ibm上看到一篇老外写的epub格式的介绍,还不错就是翻译差了点http://www.ibm.com/developerworks/cn/xml/tutorials/x-epubtut/section3.html
ps:在ibm上看到一篇老外写的epub格式的介绍,还不错就是翻译差了点http://www.ibm.com/developerworks/cn/xml/tutorials/x-epubtut/section3.html