DTD Symbols
The following is a list of symbols used in a DTD content model. The content model identifies the child elements that can appear in a parent element, the order in which they appear and the frequency in which they appear.
Symbol | Description | Example |
---|---|---|
| | Either element must appear. (Element A or element B must appear) | <!ELEMENT BOB (A | B)> |
, | Requires the elements to appear in the listed order. (Element A must appear followed by element B) | <!ELEMENT BOB (A, B)> |
? | Element is optional. If the element is used, it can only appear once. (Element A may appear once or not at all) | <!ELEMENT BOB (A?)> |
* | Element may appear zero or more times. (Element A may appear zero or more times) | <!ELEMENT BOB (A*)> |
+ | Element must appear at least once. It may also appear multiple times. (Element A must appear at least one or more times) | <!ELEMENT BOB (A+)> |
( ) | Groups nested elements. | <!ELEMENT BOB ((A, B) | C)> |
no symbol | One and only one element must appear. (Element A must appear only one time) | <!ELEMENT BOB (A)> |