Message model objects: attributes

An attribute describes an XML attribute. They are used only when the data is XML.

Global and local attributes

Attributes can be global or local.

A global attribute can be used in more than one place in the message model. It must be given a unique name by which it can be referenced by an attribute reference.

A local attribute is defined in one position within one complex type, and cannot be used elsewhere in the message model.

Default and fixed values

An attribute can be given a default value so that, if the attribute is missing from the message, the default is used. Alternatively, a fixed value can be defined, and the attribute always takes that value. The precise use of default and fixed values is dependent on the message domain.

Value constraints

The value of an attribute can be constrained by using value constraints, which define the range of legal values for the attribute. Value constraints are associated with the simple type on which the attribute is based. For more details, see Message model objects: simple types. In XML Schema, the term for value constraint is facet.