- 79 -
9.
NMTOLKENS
10.
NOTATION
Let’s take a look at each type (or groups of types since several are similar) in greater
detail.
String Attributes
Strings in attribute types are like strings in all programming languages—they are a series
of character data. In XML, string lengths not defined and can be arbitrarily long. From a
design perspective, however, we do not recommend using long strings in your attributes.
To assign a string type to an attribute called authors to an element of type book, here’s
what you’d do:
CDATA
default
>
The CDATA keyword implies a string. Strings can contain all text characters except for
special characters like quotation marks and ampersands. These exceptions are noted in
Table 3.3
. You can include these characters by using the entity references specified in
Table 3.3
.
Here’s what a book element, as specified above, could look like (assume the element
type declaration has already been made to allow PCDATA):
The Hobbit