IBM Integration Bus, Version 9.0.0.8 Operating Systems: AIX, HP-Itanium, Linux, Solaris, Windows, z/OS

See information about the latest product version

Message model objects: simple type value constraints

Value constraints, also known as facets in XML Schema, refine a simple type by defining limits on the values that it can represent.

It is often useful to be able to constrain the values that an element or attribute can take, perhaps to ensure that messages conform to business rules. This topic describes how to add value constraints to a simple type, in order to constrain the values of all elements or attributes that are based on that simple type.

If the model is deployed to IBM® Integration Bus, elements and attributes can be validated against value constraints, so that violations are reported as errors or warnings. The SOAP, XMLNSC, DFDL, and MRM domains all support validation.

Types of value constraint

Length Constraints: Length, Min Length, Max Length
Using length constraints, the length of all elements based on the simple type can be constrained, or even limited to a single value.

Length constraints can be applied to simple types that are derived from xsd:hexBinary, xsd:base64Binary or xsd:string (including built-in schema types such as xsd:normalisedString).

Length constraints are inherited from ancestor types, and any length constraints that are defined for a simple type must not relax the constraints that are imposed by any of its ancestor types. For example, a type 'longString' (Max Length=100) cannot be derived from a type 'shortString' (Max Length=10).

Range constraints: Min Inclusive, Max Inclusive, Min Exclusive, Max Exclusive
Range constraints specify the allowable range of values for all elements that are based on the simple type. Inclusive constraints include the specified endpoints in the permitted range, whereas exclusive constraints do not. Range constraints can be applied to simple types that are numeric, or that relate to calendar and time values. They cannot be applied to strings, because the ordering of string values depends on the character set that is used.

Range constraints are inherited from ancestor types, and any range constraints that are defined for a simple type must not relax the constraints that are imposed by any of its ancestor types. For example, a type 'largeNumber' (Max Inclusive=100) cannot be derived from a type 'smallNumber' (Max Inclusive=10).

Enumeration constraints
An enumeration constraint specifies a single permitted value for all elements that are based on the simple type. A list of permitted values can be specified by defining more than one enumeration constraint for the same simple type. Enumeration constraints can be applied to all simple types.

Enumeration constraints are inherited from ancestor types, and any set of enumeration constraints that are defined for a simple type must not increase the range of permitted values. For example, a type 'AllColors' (with enumerations for all colors of the rainbow) cannot be derived from a type 'MonoColors' (with enumerations for 'black' and 'white' only).

Precision constraints: Total Digits and Fraction Digits
Precision constraints relate only to decimal and integer values. They limit the number of significant digits (total digits) and, for decimals, the number of decimal places (fraction digits) for all elements that are based on the simple type. Precision constraints can be applied to simple types that are derived from xsd:decimal and xsd:integer.

Precision constraints are inherited from ancestor types, and any precision constraints that are defined for a simple type must not relax the constraints that are imposed by any of its ancestor types. For example, a type 'veryPrecise' (Fraction Digits=10) cannot be derived from a type 'notVeryPrecise' (Fraction Digits=1).

Pattern constraints
A pattern constraint is a regular expression that specifies a set of permitted values for all elements that are based on the simple type. Multiple patterns can be defined for the same simple type, permitting complex validation rules to be expressed in logically separate parts. Each pattern constraint on a simple type contributes to the set of permitted values for elements that are based on the simple type; that is, all the patterns are combined by using Boolean OR.

As with all value constraints, a simple type can inherit pattern constraints from the simple type on which it is based. In this case, the set of pattern constraints that are contributed by each ancestor type must be satisfied, in addition to the set that is contributed by the simple type itself; that is, the sets of pattern constraints from each level in the type hierarchy are combined by using Boolean AND.

White space constraints
A white space constraint specifies how a parser treats white space for all elements that are based on the simple type.
Note: For the MRM and DFDL domains, white space constraints are not applied.

ad10470_.htm | Last updated Friday, 21 July 2017