Attributes
Attributes are created and referenced in essentially the same way as elements. The Attribute element is used to create an attribute, and the name of the attribute is provided by the Name attribute. The Type attribute can be used, just as in element definitions, to specify the type of value it can contain. This declaration can appear at the end of a complex type definition. In the following example, the Security attribute is added to the Chapter element:
<element name="chapter"> <complexType> ... <attribute name="security" type="string" /> </complexType> </element> <!-- DTD EQUIVALENT: <!ATTLIST chapter security CDATA #IMPLIED> -->
Attribute Type values must always be simple data types, such as the 'string' type, and never complex ...
Get XML Companion, The, Third 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.