|
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 HTML 4.01 Transitional
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.
The allowable content of the HEAD element is:
( TITLE & ISINDEX ? & BASE ? ) +( SCRIPT | STYLE | META | LINK | OBJECT )
This means that a HEAD element can contain two groupings of possible elements. The first grouping consists of a TITLE element, an optional single ISINDEX, and an optional single BASE element. These can occur in any order.
In the second grouping, you can have
any number of the following elements appear multiple times at various positions within HEAD:
SCRIPT, STYLE, META, LINK, or OBJECT.
|
|---|