Attribute Declarations
In addition to elements, other fundamental building blocks of XML are attributes. One way to think of attributes is to imagine that elements function as nouns, and attributes are adjectives. Attributes can be used to store information that describes or modifies the information contained within an element. For example:
<phone type="office">1-800-555-1222</phone>
Here we have a phone element, which has the actual phone number as its content. However, without the type attribute, we wouldn't know whether this was a home phone, office phone, mobile phone, fax, or so on.
In this way, attributes can be very useful in XML documents, and in DTDs, attributes are declared in a manner similar to elements, using an ATTLIST declaration. ...
Get Special Edition Using XML, Second Edition 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.