Name

xs:length — Allows you to specify the precise length (in characters, bytes, or list items) of a given value

Applies to

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

Attributes

value

An xs:nonNegativeInteger

Operation

For string values, the number in value specifies the number of Unicode characters allowed in the string. The number of Unicode characters is counted after whitespace processing is completed, per the rules of the datatype being constrained and the xs:whitespace facet.

For the xs:hexBinary and xs:base64Binary types, the value specifies the number of bytes encoded. When used in lists, the xs:length facet constrains the number of items in the list.

You cannot specify xs:length at the same time you specify xs:maxLength or xs:minLength.

Get XML Pocket Reference, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.