Message model objects: elements

An element is a named piece of information (a field) within a message, with a meaning that is agreed by the applications that create and process the message.

An element has a specific meaning that is agreed by the applications that create and process the message. For example, a message might include a string that your applications have agreed is a 'Customer Name'. An element is always based on a type, either simple or complex.

An element:

  • Has a business meaning.
  • Is an instantiation of a simple or complex type.
  • Can be accessed by name from ESQL, Java™, or a Map.
  • Is further defined by its type; for example, the type defines the range of values that an element can have.
  • Can be defined globally or locally.

Simple and complex elements

Elements can be simple or complex. A simple element is a single, named piece of information such as 'Age' or 'Customer Name'. A simple element is based on a simple type that defines its content.

A complex element is a named structure that contains other elements. A complex element named 'Customer Details' might contain the simple elements 'Age' and 'Customer Name'. A complex element can also contain other complex elements. A complex element is based on a complex type that defines its content and structure.

Global and local elements

Elements can be global or local. A global element can be used in several different messages, or even in several places within the same message. It must be given a unique name by which it can be referenced by an element reference. A local element is defined in one position within one complex type or group, and is not available for reuse elsewhere in the message model.

Default and fixed values

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

Value constraints

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

Defining substitution groups

If you are modeling XML messages, an element can be marked as a valid substitute for another element by using the substitution group property on the element. In this way, groups of elements can be assembled where any of the elements in the group can substitute for one element, the head element. For further information, see Substitution groups in the message model.