XML technologies / XML Schema / XML Schema element reference / xs:minLength
(Excerpt from “XML Schema” by Eric van der Vlist)
Facet specifying a minimum length.
<xs:minLength
fixed = xs:boolean : "false"
id = xs:ID
value = xs:nonNegativeInteger
{beliebige Attribute mit einem Nicht-Schema-Namensraum}
>
Content: (xs:annotation?)
</xs:minLength>May occur within: xs:restriction (simple type), xs:restriction (simple content)
May be used as a facet for: xs:anyURI, xs:base64Binary, xs:ENTITIES, xs:ENTITY, xs:hexBinary, xs:ID, xs:IDREF, xs:IDREFS, xs:language, xs:Name, xs:NCName, xs:NMTOKEN, xs:NMTOKENS, xs:normalizedString, xs:NOTATION, xs:QName, xs:string, xs:token
Description
xs:minLength specifies the minimum permitted length in a type-dependent unit. For most data types, the unit is the character defined in XML 1.0, namely Unicode characters defined by ISO/IEC 10646, possibly represented with more than eight bits. Exceptions are binary data types (xs:hexBinary and xs:base64Binary), whose lengths count binary-data bytes of eight bits, and list types, whose lengths count list items.
xs:minLength restricts value space. In practice, it is checked after whitespace replacement and collapsing as defined by facet xs:whitespace.
Restrictions
This is a logical length, often unrelated to the storage space a value needs.
It is forbidden to define both xs:minLength and xs:length within one restriction step. Although unstated in the recommendation, defining several xs:minLength facets in one step is also meaningless.
Within one restriction step, xs:minLength also interacts with xs:maxLength, since inconsistent values produce types with empty value spaces.
xs:minLength must restrict its base type’s value space, and its value must be greater than the base type’s xs:minLength value, if defined.
Although unstated in the recommendation, an interaction exists between xs:minLength and xs:length. xs:minLength should not be defined if xs:length is defined for its base type.
Fixing facet xs:minLength does not fix facet xs:length. Use two restriction steps to fix both, since applying them in the same step is forbidden.
Example
<xs:simpleType name="longName">
<xs:restriction base="xs:NCName">
<xs:minLength value="6"/>
</xs:restriction>
</xs:simpleType>Attributes
fixed
If the value is true, this facet’s value cannot be modified in further restrictions.
id
Element ID according to W3C XML Schema.
value
Facet value.
Copyright © 2003 O'Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from “XML Schema” is subject to the same conditions as the bound edition. The work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de