Definition
Attrubutes describe their element
Contributes supplementary data about the element itself, instead of the elements contents
Information in attributes tend to be about the content of the XML page, rather thaan part of the content
Declaration
<!ATTLIST tagName attributeName ...- ...CDATA - attribute's value is composed of any combination of characters
-
...
(calue_1|value_2|...)- a choice of possible values for the attribute - confining the attribute value to the list - ...
"default_value"- a default value for the attribute - ...
#FIXED "default_value"- attribute can ONLY be this value - ...
#IMPLIED- has no default value and can be entirely omitted - ...
#REQUIRED- attribute must be present and contain a value - ...
ID #REQUIRED- attribute must be present and contain a unique value on the XML document
Enumerated Attributes
A list of preset values that an attribute can have
<!ATTLIST school year (1999|2000|2001|2002)> -
confines the values that 'year' can have to only one value in the list
For Example:
<!ATTLIST picture
filename CDATA #REQUIRED
x CDATA #REQUIRED
y CDATA #REQUIRED>
picture is the element and
x & y are required attributes
<!ATTLIST population
year CDATA #IMPLIED>
population is the element and
year is an optional attribute