Declaring Attributes in DTDs

An XML element in a well-formed document may not have two attributes of the same name. Therefore, cardinality operators are not required when attributes are declared.

The declaration of attributes takes the following general form:

<!ATTLIST 
 attributeName attributeType defaultDeclaration 
> 

The attributeType is any of the values in the following list:

  • CDATA— Any legal XML string.

  • ENTITY— Value that must match the name of an external unparsed entity.

  • ENTITIES— An ENTITY, except that more than one whitespace-separated name may occur.

  • ID— Value that must begin with a letter and then must consist of letters, numeric characters, hyphens, underscores, and period characters. At most, one attribute on any element can be ...

Get Sams Teach Yourself XML in 10 Minutes now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.