HTML and CSS Reference
In-Depth Information
Table H-16 General Form of an Element Declaration
General form:
<!ELEMENT element-name (rule)>
!ELEMENT is the declaration; element-name is any valid XML element name (see rules in Table
H-3 on page APP 74); rule is a keyword, such as ANY or #PCDATA. The ANY keyword means
other valid tags and data can be displayed; #PCDATA means only parsed character data can be
<!ELEMENT SONG (Title, Singer)>
Attribute List Declarations
A DTD can also contain an attribute list declaration. The items in the attribute list
must correspond to any attributes declared within XML elements. Table H-17 shows the
general form of an attribute list declaration.
Table H-17 General Form of an Attribute List Declaration
General form:
<!ATTLIST element-name attribute-name data-type default-value>
The element-name is the name of the XML element. The attribute-name is the name of the
attribute. The data-type is the data type of the attribute. The default-value is any default value
of the attribute. In the example, width is an attribute of the txtBox element, with a CDATA
(character data) type and default value of 10.
<!ATTLIST txtBox width CDATA "10">
The data type in an attribute list declaration can be one of 10 different kinds of data type
attributes, as shown in Table H-18.
Table H-18 DTD Data Type Attributes
Character data; can include any character string as well as special symbols for ampersand (&amp),
less-than and greater-than symbols or angle brackets (&lt or &gt), or quotation marks (&quot)
List of possible values for an attribute (such as cash/check/charge); only one can be used
Single entity; either external data or declared DTD entity
Multiple entities; either external data or declared in DTD
Unique element identifier for an attribute that distinguishes one element from others
Identifies the value of a unique ID of another element
Identifies multiple values for an attribute, separated by white space
XML name token; restricts the attribute value to any valid XML name (letters, number,
hyphens, underscores, and periods)
Allows the attribute value to include multiple XML names, separated by white space
Allows the attribute value to be a value specified in a DTD notation declaration
The default value in an attribute list declaration must match the data type. If a specific
value is noted, the value must be enclosed within quotation marks. A default value consists
of one of the four options shown in Table H-19.
Search WWH ::

Custom Search