|
Content Notation
|
The allowable content of the elements is shown using a content model syntax.
| Notation | Meaning |
|---|
| ( ) | ( and ) are grouping symbols around elements and/or other symbols
| | A | B | Either A or B occurs, but not both.
| | A , B | Both A and B occur, in that order.
| | A & B | Both A and B occur, in any order.
| | A? | A occurs zero or one time.
| | A* | A occurs zero or more times.
| | A+ | A occurs one or more times.
| | -A | A is prohibited at this point.
| | +A | A could appear multiple times at various positions.
| | EMPTY | this means that there must be nothing in the content;
elements with EMPTY content are called empty elements.
|
Examples from XHTML 1.0 Strict
The allowable content of the html element is:
( head,
body )
This means that an html element must contain exactly one
head followed by exactly
one body, in that order.
dl Content
The allowable content of the
dl definition list element is:
( dt | dd )+
This means that the
dl element contains at least one
dt or dd
element, and maybe more. Don't get confused by the
| symbol here--it does not mean that you have to choose between having
only a dt or dd
element.
The notation means you can choose either one of the elements within the ( and ). But the
+ at the end means you must make this choice at least once, but you can
repeat it as often as you wish. So you can have any number of
dt or dd elements in a
dl element.
Note that this syntax does not constrain the
sequence or number of dt's (definition terms)
or dd's (definitions).
You could have a
dl element full of a hundred
dt's and just one
dd.
|
|---|