This chapter covers the other basic building block of XML: attributes. It explains how to declare attributes and assign types to them. It also describes fixed and default values as they apply to attributes.
Whether to model data values as elements or attributes is an often-discussed question. XML Schema, with its ability to define data types for elements, eliminates many of the advantages of attributes in DTDs. The advantages of using attributes are:
• They are less verbose.
• For narrative content, attributes are typically used for values that should not appear in the content—that is, for metadata. In a typical (X)HTML document, elements are used for the content that appears on a ...