EPUBドキュメントフォーマットの簡単なまとめ


epubは電子図書標準(ファイル接尾辞名.epub)である.
 
epubは自由な開放基準であり、ファイルは本質的にxhtmlがzipアーカイブ圧縮を経て得られ、ドキュメントにいくつかのxmlを採用してファイルの構造を示す.
 
epubのファイル内部構造は下図の通りです.
 
--ZIP Container--
mimetype
META-INF/
  container.xml
OPS/
  book.opf
  chapter1.xhtml
  ch1-pic.png
  css/
    style.css
    myfont.otf

 
いくつかの重要な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の下にはmetadata,manifest,spine,guideの4つのサブノードがある.

  • 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フォーマットの紹介を見て、悪くないです.