- 72 -
The parser would interpret this declaration as follows: Elements of type
name
must
consist of exactly
two subelements called
first_name
and
last_name
in that order
and nothing else
.
first_name
elements can contain character data.
last_name
elements can contain character data.
As
expected, a legal XML expression of the
name
type of elements would look like this:
Faraz
Hoodbhoy
Although the actual content of the names can differ (that is, Faraz and Hoodbhoy),
nothing else could be changed with this declaration. For example,
Hoodbhoy
Faraz
would not work because the order is not as declared.
Also,
Faraz Hoodbhoy
would not work because the element type name was declared
to explicitly have element
content only.
A few notes about PCDATA usage:
•
All PCDATA type content models are called
mixed content
models regardless of
whether they have other elements specified.
•
The (#PCDATA) content model inherently implies zero or more characters. For
example, for our above example, both first_name and last_name
elements could be
left blank and the parser would not be upset. It would get upset if the either the
first_name or the last_name or both element tags were omitted.