The Attribute-List (ATTLIST) Declaration:

Attributes are additional information associated with an element typeglossary. They are intended for interpretation by an application. The ATTLIST declarations identify which element types may have attributes, what type of attributes they may be, and what the default value of the attributes are.

<!ATTLIST element_name attribute_name attribute_type default_value>
.
.
.
<element attribute_name="attribute_value">

where:
Example:
<?xml version="1.0"?>
<!DOCTYPE image [
	<!ELEMENT image EMPTY>
	<!ATTLIST image height CDATA #REQUIRED>
	<!ATTLIST image width CDATA #REQUIRED>
]>
<image height="32" width="32"/>

Rules:

Note:

There are three main attribute types; a string type, tokenized types, and enumerated types. They are classified as follows.

String attribute type:Attribute description:
CDATACDATA stands for character data, that is, text that does not form markup. See example.

Tokenised attribute type:Attribute description:
IDID is a unique identifier of the attribute. IDs of a particular value should not appear more than once in an XML documentvalidity constraint. An element type may only have one ID attributevalidity constraint. An ID attribute can only have an #IMPLIED or #REQUIRED default valuevalidity constraint. The first character of an ID value must be a letter, '_', or ':'validity constraint. See example.
IDREFIDREF is used to establish connections between elements. The IDREF value of the attribute must refer to an ID value declared elsewhere in the documentvalidity constraint. The first character of an ID value must be a letter, '_', or ':'validity constraint. See example.
IDREFSAllows multiple ID values separated by whitespacevalidity constraint.
ENTITYENTITYs are used to reference data that act as an abbreviation or can be found at an external location. The first character of an ENTITY value must be a letter, '_', or ':'validity constraint. See example.
ENTITIESAllows multiple ENTITY names separated by whitespacevalidity constraint. See example.
NMTOKENThe first character of an NMTOKEN value must be a letter, digit, '.', '-', '_', or ':'validity constraint. See example.
NMTOKENSAllows multiple NMTOKEN names separated by whitespacevalidity constraint.

Enumerated attribute type:Attribute description:
NOTATIONNOTATIONs are useful when text needs to be interpreted in a particular way, for example, by another application. The first character of a NOTATION name must be a letter, '_', or ':'validity constraint. See example.
EnumeratedEnumerated attribute types allow you to make a choice between different attribute values. The first character of an Enumerated value must be a letter, digit, '.', '-', '_', or ':'validity constraint. See example.

CDATA Example:
<?xml version="1.0"?>
<!DOCTYPE image [
	<!ELEMENT image EMPTY>
	<!ATTLIST image height CDATA #REQUIRED>
	<!ATTLIST image width CDATA #REQUIRED>
]>
<image height="32" width="32"/>
ID Example:
<?xml version="1.0"?>
<!DOCTYPE student_name [
	<!ELEMENT student_name (#PCDATA)>
	<!ATTLIST student_name student_no ID #REQUIRED>
]>
<student_name student_no="a9216735">Jo Smith</student_name>
IDREF Example:
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE lab_group [
	<!ELEMENT lab_group (student_name)*>
	<!ELEMENT student_name (#PCDATA)>
	<!ATTLIST student_name student_no ID #REQUIRED>
	<!ATTLIST student_name tutor_1 IDREF #IMPLIED>
	<!ATTLIST student_name tutor_2 IDREF #IMPLIED>
]>
<lab_group>
	<student_name student_no="a8904885">Alex Foo</student_name>
	<student_name student_no="a9011133">Sarah Bar</student_name>
	<student_name student_no="a9216735"
	tutor_1="a9011133" tutor_2="a8904885">Jo Smith</student_name>
</lab_group>
ENTITY Example:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE experiment_a [
	<!ELEMENT experiment_a (results)*>
	<!ELEMENT results EMPTY>
	<!ATTLIST results image ENTITY #REQUIRED>
	<!ENTITY a SYSTEM "http://www.university.com/results/experimenta/a.gif">
]>
<experiment_a>
	<results image="a"/>
<experiment_a>
ENTITIES Example:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE experiment_a [
	<!ELEMENT experiment_a (results)*>
	<!ELEMENT results EMPTY>
	<!ATTLIST results images ENTITIES #REQUIRED>
	<!ENTITY a1 SYSTEM "http://www.university.com/results/experimenta/a1.gif">
	<!ENTITY a2 SYSTEM "http://www.university.com/results/experimenta/a2.gif">
	<!ENTITY a3 SYSTEM "http://www.university.com/results/experimenta/a3.gif">
]>
<experiment_a>
	<results images="a1 a2 a3"/>
</experiment_a>
NMTOKEN Example:
<?xml version="1.0"?>
<!DOCTYPE student_name [
	<!ELEMENT student_name (#PCDATA)>
	<!ATTLIST student_name student_no NMTOKEN #REQUIRED>
]>
<student_name student_no="9216735">Jo Smith</student_name>
NOTATION Example:
<?xml version="1.0"?>
<!DOCTYPE code [
	<!ELEMENT code (#PCDATA)>
	<!NOTATION vrml PUBLIC "VRML 1.0">
	<!ATTLIST code lang NOTATION (vrml) #REQUIRED>
]>
<code lang="vrml">Some VRML instructions</code>
Enumerated Example:
<?xml version="1.0"?>
<!DOCTYPE ToDoList [
	<!ELEMENT ToDoList (task)*>
	<!ELEMENT task (#PCDATA)>
	<!ATTLIST task status (important|normal) #REQUIRED>
]>
<ToDoList>
	<task status="important">This is an important task that must be completed</task>
	<task status="normal">This task can wait</task>
</ToDoList>

The "default_value" signifies whether an attribute is required or not, and if not, what default value should be displayed. The possible default values are listed in below.

Default value:Description:
#REQUIREDThe attribute must always be includedvalidity constraint.
#IMPLIEDThe attribute does not have to be included.
#FIXED "Default_Value"The attribute must always have the default value that is specifiedvalidity constraint. If the attribute is not physically added to the element tag in the XML document, the XML processor will behave as though the default value does exist. The first character of a default value can be any character except for '&', '<', '"'. It can also be an entity reference (i.e. '&Name;'), or a character referencevalidity constraint. See example.

Default Value Examples:
<?xml version="1.0"?>
<!DOCTYPE ToDoList [
	<!ELEMENT ToDoList (task)*>
	<!ELEMENT task (#PCDATA)>
	<!ATTLIST task status (important|normal) "normal">
]>
<ToDoList>
	<task status="important">This is an important task.</task>
	<task>This is by default a task that has a normal status.</task>
</ToDoList>
<?xml version="1.0"?>
<!DOCTYPE ToDoList [
	<!ELEMENT ToDoList (task)*>
	<!ELEMENT task (#PCDATA)>
	<!ATTLIST task status NMTOKEN #FIXED "monthly">
]>
<ToDoList>
	<task>go to the bank</task>
	<task>pay the phone bill</task>
</ToDoList>

Predefined attributes:

Predefined attributes:Description:
xml:langDefines the language code in which the content of the element is written in. The attribute values of xml:lang should follow ISO-639 if they are two-letter codes, and ISO-3166 if they contain two-letter subcodes. Language identifiers registered with the IANAglossary should contain the prefix "I-" or "i-". Any privately used codes should contain the prefix "X-" or "x-".
xml:spacePreserves white space within a document, that is, passes all white space to the application unchanged. Useful when displaying text such as program source code.

Example:
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE document [
	<!ELEMENT document (description,code)>
	<!ELEMENT description (#PCDATA)>
	<!ATTLIST description xml:lang NMTOKEN #FIXED "en">
	<!ELEMENT code (#PCDATA)>
	<!ATTLIST code xml:space (default|preserve) "preserve">
]>
<document>
	<description xml:lang="en">
	The following section of code diplays the menu of user
	choices and gets the user's request.
	</description>
	<code>
	do
	  {
		do
		 { disp_menu();
		   scanf(" %d", &amp;ans);
		 } while ((ans&lt;1) || (ans&gt;3));
	</code>
</document>