The number of characters allowed in a string
Must be a non-negative integer
Applies to string
,
normalizedString
, token
,
hexBinary
, base64Binary
, QName
, NCname,
ID
, IDREF
, IDREFS
, language
, anyURI
, ENTITY
, ENTITIES
, NOTATION,
NOTATIONS
, NMTOKEN
and
NMTOKENS
type items
For example, to say that all names and titles must contain between 1 and 255 characters:
<?xml version="1.0"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="SONG" type="songType"/> <xsd:simpleType name="Str255"> <xsd:restriction base="xsd:string"> <xsd:minLength value="1"/> <xsd:maxLength value="255"/> </xsd:restriction> </xsd:simpleType> <xsd:complexType name="songType"> <xsd:sequence> <xsd:element name="TITLE" type="Str255"/> <xsd:element name="COMPOSER" type="Str255" maxOccurs="unbounded"/> <xsd:element name="PRODUCER" type="Str255" minOccurs="0" maxOccurs="unbounded"/> <xsd:element name="PUBLISHER" type="Str255" minOccurs="0"/> <xsd:element name="LENGTH" type="xsd:timeDuration"/> <xsd:element name="YEAR" type="xsd:gYear"/> <xsd:element name="ARTIST" type="Str255" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:schema>