XML technologies / ePUB / Open Publication Structure / Comparative overview
(Excerpt from “E-Books mit ePUB ─ Von Word zum E-Book mit XML” by Dr. Victor Wang)
Conceptual differences appear already in the basic structure of content files.
Start with a simple example, the preface to Max und Moritz, also used in the code examples under Navigation in page-based structures, and compare both formats. Here is the XHTML file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> ①
<head> ②
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Vorwort</title> ③
</head>
<body> ④
<h1>Vorwort</h1> ⑤
<div class="dtb:pagenum" id="s0343">
<p>343</p>
</div>
<p>Ach, was muss man oft von bösen</p>
<p>Kindern hören oder lesen!!</p>
<p>Wie zum Beispiel hier von diesen,</p>
<p>Welche Max und Moritz hießen;</p>
<div class="block-grafik">
<img src="img/Max_und_Moritz_001.png" alt="Max und Moritz"/>
</div>
<p>Die, anstatt durch weise Lehren</p>
<p>Sich zum Guten zu bekehren,</p>
<p>Oftmals noch darüber lachten</p>
<p>Und sich heimlich lustig machten. -</p>
. . .
</body>
</html>
Code example: Max und Moritz structure in XHTML
For direct comparison, here is the document structured in DTBook:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//NISO//DTD dtbook 2005-3//EN" "http://www.daisy.org/z3986/2005/dtbook-2005-3.dtd">
<book xmlns="http://www.daisy.org/z3986/2005/dtbook/"> ⑥
<frontmatter> ⑦
<doctitle>Vorwort</doctitle> ⑧
<level> ⑨
<pagenum id="s0343">343</pagenum>
<hd>Vorwort</hd> ⑩
<linegroup>
<line>Ach, was muss man oft von bösen</line>
<line>Kindern hören oder lesen!!</line>
<line>Wie zum Beispiel hier von diesen,</line>
<line>Welche Max und Moritz hießen;</line>
<img src="img/Max_und_Moritz_001.png" alt="Max und Moritz"/>
<line>Die, anstatt durch weise Lehren</line>
<line>Sich zum Guten zu bekehren,</line>
<line>Oftmals noch darüber lachten</line>
<line>Und sich heimlich lustig machten. -</line>
</linegroup>
. . .
</level>
</frontmatter>
</book>
Code example: Max und Moritz structure in DTBook
The roots are <html> at ① and <book> at ⑥, each defining its own namespace.
XHTML content is relatively flat within <body> at ④: everything below is side by side, sibling nodes in the XML tree, without enclosing semantics.
DTBook has a deeper hierarchy. Its first container is <frontmatter> at ⑦, placing the document in the front matter. The preface is a <level> element at ⑨, a chapter structure. Thus its heading <hd> is clearly assigned at the chapter’s beginning ⑩. XHTML’s isolated heading <h1> at ⑤ does not identify which paragraphs belong to the preface. DTBook’s following <linegroup> groups every line in a stanza, a structure lacking in XHTML.
XHTML advocates will object that hierarchies can also be represented with classified <div> elements. The example does this twice, for page number and graphic, both enclosed in such blocks. We will explore this further.
Copyright © mitp 2011
You may print the online version for your private use.
Otherwise, this chapter from “E-Books mit ePUB” is subject to the same terms as the printed edition: the work and all its parts are protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
Verlagsgruppe Hüthig Jehle Rehm GmbH, Im Weiher 10, 69121 Heidelberg, kundenbetreuung(at)hjr-verlag.de
back to top