Tamino XML Server Version 9.7
 —  Tamino XML Schema Reference Guide  —

xs:maxLength

Purpose

This element is a restriction facet that specifies an inclusive maximum length constraint for a data item.

The actual value of the constraint is given by the value attribute.

Parent element xs:restriction
Child elements None
Attributes fixed, value
Restrictions

The following restrictions apply:

  • The xs:maxLength element may not be specified simultaneously with the xs:length element.

  • If an xs:maxLength element is specified along with the xs:minLength element in the same restriction, the value attribute of the xs:minLength element must be less than or equal to the value attribute of the xs:maxLength element.

  • The following update schema constraint applies to the xs:maxLength element:

    The value of xs:maxLength is not permitted to become more restrictive after update schema.

    This means that if an xs:maxLength element is specified for the base type, the value attribute of this element in the derivation must not be greater than the value attribute of the base type.

Attributes
Name Type Description
fixed xs:boolean If "true", the value of this facet must not be changed in a derived type. Default: "false".
value xs:nonNegativeInteger

The value attribute specifies the maximum length of the restricted type.

The value of the xs:maxLength facet is measured in different units, depending on the base type of the restriction:

  • Binary data
    (such as "hexBinary" or "base64Binary"):

    Octets

  • List data
    (such as "IDREFS", "ENTITIES", "NMTOKENS"):

    Number of list items

  • String types:
    Number of characters

Example

The following example shows a simple type definition based on a restriction using the xs:maxLength element. The string length is restricted to 80 characters:

<xs:simpleType name='input-field'>
  <xs:restriction base='xs:string'>
    <xs:maxLength value='80'/>
  </xs:restriction>
</xs:simpleType>

Top of page