XML technologies / XML / XML in a Nutshell / XML as a document format / DocBook
(Excerpt from "XML in a Nutshell" by Elliotte Rusty Harold & W. Scott Means)
DocBook is an SGML application designed for new rather than old documents. It is particularly common in computer documentation. Several O'Reilly books were written in DocBook, including Norm Walsh and Leonard Muellner’s DocBook: The Definitive Guide. No special tools are required. Much of the Linux Documentation Projects (LDP) is written in DocBook. The current version, 4.3, is available as both SGML and XML (Note from the data2type editors: DocBook 5.0 is now available, as of 2010). The following example shows a simple DocBook XML document based on this book, “XML in a Nutshell”. The complete document would naturally be much longer.
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "docbook/docbookx.dtd">
<book>
<title>XML in a Nutshell</title>
<bookinfo>
<author>
<firstname>Elliotte Rusty</firstname>
<surname>Harold</surname>
</author>
<author>
<firstname>W. Scott</firstname>
<surname>Means</surname>
</author>
</bookinfo>
<toc>
<tocchap><tocentry>Einführung in XML</tocentry></tocchap>
<tocchap><tocentry>XML als Dokumentformat</tocentry></tocchap>
<tocchap><tocentry>XML im Web</tocentry></tocchap>
</toc>
<chapter>
<title>Einführung in XML</title>
<para></para>
</chapter>
<chapter>
<title>XML als Dokumentformat</title>
<para>XML ist vor allen Dingen ein Dokumentformat. Es war immer für Webseiten, Bücher, wissenschaftliche Artikel, Gedichte, Kurzgeschichten, Referenzhandbücher, Anleitungen, Lehrbücher, Plädoyers, Verträge, Gebrauchsanweisungen und andere Dokumente gedacht, die von Menschen gelesen werden. Sein Einsatz als Syntax für Computerdaten in Anwendungen wie Bestellabwicklung, Objektserialisierung, Datenbanken sowie elektronischen Datenaustauschsystemen ist eigentlich nur ein glücklicher Zufall.</para>
<sect1>
<title>Das Vermächtnis von SGML</title>
<para></para>
</sect1>
<sect1>
<title>TEI</title>
<para></para>
</sect1>
<sect1>
<title>DocBook</title>
<para><ulink url="http://www.docbook.org/">DocBook</ulink> ist eine SGML-Anwendung, die für neue Dokumente, jedoch nicht für alte entworfen wurde. Es ist besonders bei Computer-Dokumentationen gebräuchlich. Verschiedene O'Reilly-Bücher wurden in DocBook geschrieben, einschließlich <citation>Norm Walshs and Leonard Muellners <title>DocBook: The Definitive Guide</title></citation>. Ein Großteil des Texts des <ulink url="http://www.linuxdoc.org/">Linux Documentation Projects (LDP)</ulink> wurde in DocBook geschrieben.</para>
</sect1>
</chapter>
<chapter>
<title>XML im Web</title>
<para></para>
</chapter>
<index>
<indexentry>
<primaryie>SGML, 8, 89</primaryie>
</indexentry>
<indexentry>
<primaryie>DocBook, 95-98</primaryie>
</indexentry>
<indexentry>
<primaryie>TEI (Text Encoding Initiative), 92-95</primaryie>
</indexentry>
<indexentry>
<primaryie>Text Encoding Initiative</primaryie>
<seeie>TEI</seeie>
</indexentry>
</index>
</book>Code example: A DocBook document
DocBook offers technical writers many benefits. It is open and nonproprietary and works with any text editor. Writing open-source software documentation in a closed proprietary tool such as Microsoft Word would be rather odd, though it has happened. DocBook documents are not tied to particular platforms, vendors, or applications and can be ported to any environment.
DocBook is practical, not merely theoretically possible, to edit in ordinary text editors. One of us, Harold, wrote an entire 1,200-page book by hand in JEdit (Processing XML with Java, Addison Wesley, 2002). If you want assistance, numerous free tools exist, including an Emacs major mode. DocBook is modular: use the parts you need and ignore the rest. A comprehensive table module is available if needed, but otherwise need not be learned or used. Other modules handle various entity sets and equations.
DocBook is an authoring format, not a final presentation format. Before reading, a DocBook document is converted to a presentation format such as:
HTML
XSL Formatting Objects
Rich Text Format (RTF)
TEX
For high-quality printed software documentation, you could convert DocBook to TEX, then convert the TEX file using standard TEX tools into DVI or PostScript and print it. For onscreen reading, convert to HTML and open it in a browser. Choose other formats for other needs. DocBook essentially gives you these formats for free: producing multiple outputs from one source is easy. This benefit applies to most well-designed XML authoring formats, not just DocBook.
Copyright © 2005 O'Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from the book "XML in a Nutshell" is subject to the same conditions 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.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de
back to top