Java APIs for XML Kick Start By Aoyon Chowdhury, Parag Choudhary
Table of Contents
Appendix B. XML: A Quick Tour
Attributes are name-value pairs that can be associated with an element. The attributes provide additional information about the element, and can be specified only in the start tag of an element. In our example, the id, type, capacity, and price attributes provide additional information about the engine element.
An important point to remember is that if you declare a set of attributes with an element in a DTD and then declare another set of attributes when the element appears again, the attribute set is merged. If the same attribute is defined twice, the second declaration is ignored and only the first one is considered. However, an XML document is considered invalid if it has an element that contains two attributes with the same name.