2.2. Elements and tags

SGML categorizes document text into various elements. These elements can be blocks of text, such as paragraphs, lists, tables, sections, and chapters; as well as in-line text such as function names, variable names, emphasized words, and so on. Each element is identified by marking up the text with tags. In the following example, the text has been classified as a Para (paragraph) element, by marking it up with <para> and </para> tags:

<para>This is the text of the paragraph...</para>

SGML elements are interdependent, with parent/child relationships. Each DTD specifies which child elements are allowed by which parent elements, and under what circumstances. For example, the Book element of DocBook has Chapter as a child, which has Sect1 as a child, and so on. Unfortunately, if you don't use elements correctly and consistently, the source files will not parse correctly, and the output will look strange--if you get any output at all. Here is where Emacs/PSGML comes in handy; it notifies you of any invalid element tags.

2.2.1. DocBook elements

DocBook has hundreds of elements to choose from. We try to use the smallest subset of them as we can, but it's still a pretty long list. The reference pages of DocBook - The Definitive Guide (TDG) by Normal Walsh discuss each element and its permissible parents, children, and attributes. I strongly recommend downloading a copy of this book and bookmarking it in your favorite browser if you plan to edit our documentation very often. For quick reference, I've listed the 130 or so tags of the elements we commonly use in the Frequently Used DocBook Tags appendix of this manual, along with short descriptions. I've tried to arrange some of them within their categories hierarchically, but it is futile to try to show every possible permutation. They are well documented and listed alphabetically (with all the other DocBook tags) in DocBook TDG.

The tags are arranged in the appendix like this:

2.2.2. Element attributes

Most elements have attributes, which can be modified for various purposes. Attributes are specified in the start-tag of an element, and their syntax typically looks like this:

<elementname attributename="attributevalue">

For example, a cols attribute that specifies 2 columns for the Tgroup element of a table would look like this:

<tgroup cols="2">

The attribute we use most frequently is id, which lets us identify elements of the document so that they can be linked to. For example, the start tag for the copy function reference entry in the Gamma manual looks like this:

<refentry id="re-copy">

To avoid duplication of id attributes, our documents follow a convention where the first two letters (four for Cascade Compatible drivers in the bookset) of the id attribute identify the book or part of a book, followed by a dash, followed by the exact name of the chapter or section, all written in lower case. (This is because XML attributes must be all lower case.) The codes we use are as follows:

Guides and Complete Manuals

ap-The Cogent API guide.
cc-The Cascade Connect guide.
cs-The Cascade Connect Client/Server Protocol manual.
dh-The Cascade DataHub guide.
drcf-The CIF Driver manual.
drdn-The 5136-DNP Driver manual.
drpb-The 5136-PFB Driver manual.
drgn-Cogent Driver generic content.
gg-The Gamma/GTK guide.
gl-The Glossary and FAQ.
gm-The Gamma guide.
gp-The Gamma/Photon guide.
gq-The Gamma/MySQL guide.
hi-The Cascade Historian manual.
mb-The SA85 Driver manual.
pd-The Processing Cogent Documentation manual.
sd-The 5136-SD Driver manual.
sr-The SRR Module manual.
tl-The Cascade TextLogger manual.
tu-The Linux and QNX Tools Demo and Tutorials manual.
wp-The Cogent White Papers.

Indices, References, Examples, Commands, etc.

ix-An index entry in any manual.
re-A reference entry in any manual.
rs-A reference section in any manual.
ex-A example in any manual.
re-apcmds-A Cogent API command.
re-dhcmds-A Cascade DataHub command.
re-drxxcmds-A Cogent Driver command in the bookset, where xx is the two-letter driver code.
re-hicmds-A Cascade Historian command.
re-tlcmds-A Cascade TextLogger command.
[Important]

When a document is processed into HTML chunks, any element that would start a new page, such as a chapter, sect1, appendix, etc. is named according to its id attribute. If there is no id attribute, the processor assigns that element a unique name, consisting of a letter followed by one or more integers. Whenever the document is edited and content is added or deleted, this name can change.

Since our Cogent Documentation bookset eventually gets published on the web, people are bookmarking and/or linking to it, so these pages should maintain constant names. Thus, every part, chapter, sect1, reference, appendix, and any other element that starts a new page should have an id assigned to it.

The only exceptions to this are indices and copyright pages, which, because of processing reasons, should not or cannot have assigned ids.