<?xml version='1.0' encoding='utf-8'?> <!-- -*- xml -*- --> <chapter id="structure"> <title>Structure</title> <para>DocBook documents are SGML documents. That includes DocBook XML documents as well; XML is a subset of SGML. The SGML declaration at the top identifies it as a DocBook document, and it should look something like this:</para> <programlisting> <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"[ … ]> <book> … </book> </programlisting> <para>The <sgmltag>book</sgmltag> here specifies the type of the top-level element of the document. This declaration also says that the document conforms to version 4.2 of the DocBook XML document type declaration (DTD). The <sgmltag>book</sgmltag> element is also shown (although without its content)—notice that it is opened with <quote><literal><book></literal></quote> and closed with <quote><literal></book></literal></quote>, and everything in between is the content of that element.</para> <para>Other files can be included by the top-level file by the use of entities. To include a file you first declare an entity and then use it:</para> <programlisting> <!DOCTYPE …[ <!ENTITY includedfile SYSTEM "includedfile.xml"> ]> … &includedfile; … </programlisting> <para>Because SGML tags (<literal><…></literal>) and entities (<literal>&…;</literal>) are interpreted specially, there are escapes provided to enable you to use these marker characters in your DocBook files. <quote><literal>&lt;</literal></quote> gives <quote><</quote>; <quote><literal>&gt;</literal></quote> gives <quote>></quote>; and <quote><literal>&amp;</literal></quote> gives <quote>&</quote>. There are many other predefined entities too.</para> </chapter> <!-- Local Variables: --> <!-- sgml-indent-step: 1 --> <!-- sgml-indent-data: 1 --> <!-- sgml-parent-document: "selfdocbookx.xml" --> <!-- End: -->