|
Table 3.7 Attribute List Declarations Part 2: Assigning an Attribute’s TypeBog'liq Ceponkus, Hoodbhoy - Applied XML - Toolkit for ProgrammersTable 3.7 Attribute List Declarations Part 2: Assigning an Attribute’s Type
Partial Attribute Type Declaration
Interpretation
CDATA
d
e
fault
>
A string type attribute. An element of type
car
has a
manufacturer
attribute associated with it
that contains string information.
Acceptable XML document entries for
car
:
- 83 -
or
(American|European|Japanes)
default
>
An enumerated attribute type. An element of
type
car
has a
manufacturer
attribute associated
with it that can only contain one of the following
values: American, European, or Japanese.
Acceptable XML document entries:
or
or
Unacceptable entry:
ENTITY
default
>
An ENTITY attribute type. An element of type
car
has a
logo
attribute associated with it that
can hold one previously declared entity.
Acceptable XML document entry (assume
pentagon
is a previously declared entity):
Unacceptable entry:
ENTITIES
default
>
ENTITIES attribute type, similar to ENTITY
types. An element of type
car
has a
logo
attribute associated with it that can hold one or
more previously declared entities.
Acceptable XML document entries (Assume
pentagon
and
arrow_head
are previously
declared entities):
or
- 84 -
Unacceptable entry:
ID
default
>
ID attribute type. An element of type
car
has a
chassis_number
attribute associated with it that
holds a value that is unique throughout the
entire XML document. IDs start with either a
letter(A–Z), an underscore (_), or a colon (:).
Acceptable XML document entry (assume
C12345
hasn’t been used before):
Unacceptable entry (assume above element is
included in document):
Reference
IDREF
default
>
IDREF attribute type. An element of type
car_to_recall
uses a
Reference
attribute
associated with it that points to another element
in the document bearing a unique ID value.
Acceptable XML document entry (assume
C12345
has been uniquely assigned to a
element—possibly
car
, though not necessarily
so):
"C12345">
Unacceptable entry:
"
unused_ID
">
Reference
IDREFS
default
>
IDREFS attribute type, plural of IDREF. An
element of type
cars_to_recall
uses a
Reference
attribute associated with it to point to one or
more other elements in the document bearing
unique ID values.
Acceptable XML document entries (assume
C12345
and
B67890
have been uniquely
assigned to some elements in the document):
or
"C12345">
- 85 -
Unacceptable entries:
"
unused_ID
">
or
NMTOKEN
default
>
NMTOKEN attribute type. An element of type
car
has a
hubcap_type
attribute whose values
contain no white space.
Acceptable XML document entry:
Unacceptable entry:
|
| |