Next / Previous / Contents / Shipman's homepage

4. Creating and translating your document

4.1. What is DocBook and how does it relate to XML?

DocBook is a document type derived from an ISO standard called XML (eXtensible Markup Language). (HTML, used to write World Wide Web pages, is also a markup language, and XML is similar in syntax.) All XML document types use the idea of tags to structure a document.

  • A tag always starts with a less-than character (“<”) and ends with a greater-than character (“>”).

  • Most tags are used in pairs, with content enclosed between a start tag and an end tag.

    For example, major sections of a document are always enclosed between a <section> start tag and a </section> end tag.

  • The term element refers to a pair of tags and everything in between them.

  • A start tag has the form

    <tag-name attributes>
    

    and the end tag has the form

    </tag-name>
    

    where the tag-name is some name that describes what the tag does.

  • In some cases, you can specify optional attributes that modify the characteristics of the element. Each attribute has this form:

    N="V"
    

    or

    N='V'
    

    where N is the attribute's name and V is the attribute's value.

    Here is an example of a start tag with attributes:

    <itemizedlist spacing='compact' role='draft'>
    

  • An empty element is a special element consisting of one tag. In this case, the tag must have a forward slash (/) just before the closing “>”. For example, the <colspec/> empty element describes the format of a table column in a table (see Section 12, “Tables”).

  • You can add whitespace (spaces, tabs, or line breaks) anywhere before or after an attribute, or before the closing “>”.