O'Reilly logo

Definitive XML Schema, Second Edition by Priscilla Walmsley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. Attribute declarations

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.

7.1. Attributes vs. elements

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required