The DTD defines each element in an element declaration. The declaration uses a precise notation to describe an element, its required components, and any elements it can or cannot contain. An element may also have characteristics defined in an attribute declaration, which is discussed in the section "Attribute List Declarations".
The syntax of an element declaration is:
<ELEMENT element_type minimization (content model) >
Specifies the element name, which is also used as the tag name. For example, the tag for the element type head is <head>.
A two-character entry that indicates whether a start or an end tag is required. The first character represents the start tag; the second character represents the end tag. A space separates the two characters. The letter o means that the tag is optional. A - (minus sign) indicates the tag is required. For example, an entry like this, - - , indicates that the element requires both start and end tags. The DTD for Helptag 1.3 requires start and end tags for every element.
Specifies a list of the required and optional elements that the element type can contain. It defines the sequence of elements and, if applicable, the number of occurrences that may occur.
The content model uses these notations:
A vertical bar represents "or".
Element must appear at least once. It can be repeated.
Element can appear zero or more times.
Element can appear zero or one time.
A comma describes sequence, that is, the element type must be followed by the element specified after the comma.
The + (plus sign) indicates that the listed element or elements can be used within the element type or within any of the elements it contains. It is called an inclusion. Parentheses are used to enclose one or more elements.
A - (minus sign) indicates that the listed element or elements cannot be used within this element, or within any of the elements it contains. It is called an exclusion. Parentheses are used to enclose one or more elements.
Each example contains a word description for the element declaration provided. Required start and end tags are assumed.
A chapter requires a <chaphead> followed by text. A chapter can contain zero or more s1 elements followed by zero or more rsect elements.
<!ELEMENT chapter - - (chaphead, text, (s1*, rsect*)) >
A chaphead requires a head followed by an optional abbrev. A chaphead cannot contain these elements: memo,location, or idx.
<!ELEMENT chaphead - - (head, abbrev?) -(memo | location | idx) >
The paragraph element requires a start tag (-) and an end tag (-). It can contain an optional head (?) followed by the partext element. newline elements can be used within p or any of the elements it contains.
<!ELEMENT p - - (head?, partext) +(newline) >
A note contains text. It can have an optional head. A note cannot contain these elements: note, caution, or warning.
<!ELEMENT note - - (head?, text) -(note | caution | warning) >
A list may contain an optional head. It requires at least one item, which can be repeated.
<!ELEMENT list - - (head?, item+) >
The book element declaration uses an exclusion to specify that it cannot contain another book element.
<!ELEMENT book - - (partext) -(book) >