Every element can have an unlimited number of attributes. Attributes are a special form of content. They are meant to represent unique properties that are bound very tightly to an individual element. Unlike the element's text content or subelement structure, the attributes tend to be very constrained.
An element can only have a single value for any attribute. A tag that contains two attributes with the same name produces a fatal error.
The XML document definition mechanisms allow us to define attributes unambiguously. We state which attributes each element may or must have. We establish the type of each attribute and we can limit its valid values. Default values can be specified by the data designer.
Validating XML parsers will insure that a document's attributes fit the constraints we've established. No other content can be validated this rigorously, so attributes have an important role in an XML document in transmitting critical data.
Attributes are organized in ActionScript as an associative array, which is a member of the element node object. The name of the attribute becomes the index into the array and the value becomes the string content of the associated array element. Parsing the value into numeric form (for example) is the responsibility of the programmer, although in practice it is often performed automatically by ActionScript's implicit casting operations.
Attributes are presented as names and values joined with an equal sign (=).
attrib = "value"
Attribute names must comply with the name constraints we studied earlier. Spaces are permitted but not required. Most important, the value must always be a quoted string.
Each attribute must have
It may include:
Attribute values must not make references outside the document they appear in. (We will see later how these references are made in other parts of the XML document.)
Attribute values cannot contain a < character, except as < .
Examples of Attribute