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