HTML and CSS Reference
In-Depth Information
can indicate groups within a rule by enclosing them in parentheses in
the DTD. For example:
Document ::= A, B, C, (D | E | F), G
requires that a document begin with elements A, B, and C, followed by
a choice of one element out of D, E, or F, followed by element G.
Repetition rules let you repeat one or more elements some number of
times. With XML, as with many other languages, you denote repetition
by appending a special character suffix to an element or group within a
rule. Without the special character, that element or group must appear
exactly once in the rule. Special characters include the plus sign ( + ),
meaning that the element may appear one or more times in the docu-
ment; the asterisk ( * ), meaning that the element may appear zero or
more times; and the question mark ( ? ), meaning that the element may
appear either zero or one time.
For example, the rule:
Document ::= A, B?, C*, (D | E | F)+, G*
creates an unlimited number of correct documents with the elements
A through F. According to the rule, each document must begin with A,
optionally followed by B, followed by zero or more occurrences of C, fol-
lowed by at least one, but perhaps more, of either D, E, or F, followed
by zero or more Gs. All of the following examples (and many others)
match this rule:
Search WWH ::

Custom Search