The number of units allowed in a value
For strings (string
,
normalizedString
, token
,
QName
, NCname
,
ID
, IDREF
,
language
, anyURI
, ENTITY
,
NOTATION
, and NMTOKEN
)
the units are characters
For lists (IDREFS
, ENTITIES
,
and
NMTOKENS
) the units are tokens
For binary types (hexBinary
, base64Binary
)
the units are bytes after decoding
Must be a non-negative integer
For example, to say that all names and titles must contain between 1 and 255 characters:
<?xml version="1.0"?>
<element name="SONG" xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<element name="TITLE">
<data type="string">
<param name="minLength">1</param>
<param name="maxLength">255</param>
</data>
</element>
<oneOrMore>
<element name="COMPOSER">
<data type="string">
<param name="minLength">1</param>
<param name="maxLength">255</param>
</data>
</element>
</oneOrMore>
<zeroOrMore>
<element name="PRODUCER">
<data type="string">
<param name="minLength">1</param>
<param name="maxLength">255</param>
</data>
</element>
</zeroOrMore>
<optional>
<element name="PUBLISHER">
<data type="string">
<param name="minLength">1</param>
<param name="maxLength">255</param>
</data>
</element>
</optional>
<optional>
<element name="LENGTH">
<data type="string"/>
</element>
</optional>
<optional>
<element name="YEAR">
<data type="gYear"/>
</element>
</optional>
<oneOrMore>
<element name="ARTIST">
<data type="string"/>
</element>
</oneOrMore>
</element>
In compact syntax:
element SONG {
element TITLE {
xsd:string { minLength = "1" maxLength = "255" }
},
element COMPOSER {
xsd:string { minLength = "1" maxLength = "255" }
}+,
element PRODUCER {
xsd:string { minLength = "1" maxLength = "255" }
}*,
element PUBLISHER {
xsd:string { minLength = "1" maxLength = "255" }
}?,
element LENGTH { xsd:string }?,
element YEAR { xsd:gYear }?,
element ARTIST { xsd:string }+
}