This chapter provides a quick reference to all of the datatypes W3C XML Schema defines. Each datatype is listed with its constraining facets, as well as information about what it represents and how.
xs:anyURI | URI (Uniform Resource Identifier). |
<xs:simpleType name="anyURI" id="anyURI"> <xs:restriction base="xs:anySimpleType"> <xs:whiteSpace value="collapse" fixed="true"/> </xs:restriction></xs:simpleType> |
xs:anySimpleType
xs:anyURI
none
xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace
This datatype corresponds normatively to the XLink href attribute. Its value space includes the URIs defined by the RFCs 2396 and 2732, but its lexical space doesn't require the character escapes needed to include non-ASCII characters in URIs.
Relative URIs are not "absolutized" by W3C XML Schema. A datatype defined as:
<xs:simpleType name="schemaRecommendations"> <xs:restriction base="xs:anyURI"> <xs:enumeration value="http://www.w3.org/TR/xmlschema-0/"/> <xs:enumeration value="http://www.w3.org/TR/xmlschema-1/"/> <xs:enumeration value="http://www.w3.org/TR/xmlschema-2/"/> </xs:restriction> </xs:simpleType>
should not validate the href attribute in this instance element:
<a xml:base="http://www.w3.org/TR/" href="xmlschema-1/"> XML Schema Part 2: Datatypes </a>
The Recommendation states that "it is impractical for processors to check that a value is a context-appropriate URI reference," freeing schema processors from having to validate the correctness of the URI.
<xs:simpleType name="httpURI"> <xs:restriction base="xs:anyURI"> <xs:pattern value="http://.*"/> </xs:restriction> </xs:simpleType>
xs:base64Binary | Binary content coded as "base64". |
<xs:simpleType name="base64Binary" id="base64Binary"> <xs:restriction base="xs:anySimpleType"> <xs:whiteSpace value="collapse" fixed="true"/> </xs:restriction> </xs:simpleType> |
xs:anySimpleType
xs:base64Binary
none
xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace
The value space of xs:base64Binary is the set of arbitrary binary contents. Its lexical space is the same set after base64 coding. This coding is described in Section 6.8 of RFC 2045.
RFC 2045 has been defined to transfer binary contents over text-based mail systems. It imposes a line break at least every 76 characters to avoid the inclusion of arbitrary line breaks by the mail systems. Sending base64 content without line breaks is nevertheless a common usage for applications such as SOAP and the W3C XML Schema Working Group. After a request from other W3C Working Groups, the W3C XML Schema Working Group decided to remove the obligation to include these line breaks from the constraints on the lexical space. (This decision was made after the publication of the W3C XML Schema Recommendation and should be included in a release of the errata.)
<xs:element name="picture"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:base64Binary"> <xs:attribute name="type" type="graphicalFormat"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element>
xs:boolean | Boolean (true or false). |
<xs:simpleType name="boolean" id="boolean"> <xs:restriction base="xs:anySimpleType"> <xs:whiteSpace value="collapse" fixed="true"/> </xs:restriction> </xs:simpleType> |
xs:anySimpleType
xs:boolean
none
xs:pattern, xs:whiteSpace
The value space of xs:boolean is "true" and "false," and its lexical space accepts true, false, and also "1" (for true) and "0" (for false).
This datatype cannot be localized--for instance, to accept "vrai" and "faux" instead of "true" and "false".
<book id="b0836217462" available="true"/>
xs:byte | Signed value of 8 bits. |
<xs:simpleType name="byte" id="byte"> <xs:restriction base="xs:short"> <xs:minInclusive value="-128"/> <xs:maxInclusive value="127"/> </xs:restriction> </xs:simpleType> |
xs:short
xs:decimal
none
xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace
The value space of xs:byte is the integers between -128 and 127, i.e., the signed values that can fit in a word of 8 bits. Its lexical space allows an optional sign and leading zeros before the significant digits.
The lexical space does not allow values expressed in other numeration bases (such as hexadecimal, octal, or binary).
Valid values for byte include 27, -34, +105, and 0.
Invalid values include 0A, 1524, and INF.
xs:date | Gregorian calendar date. |
<xs:simpleType name="date" id="date"> <xs:restriction base="xs:anySimpleType"> <xs:whiteSpace value="collapse" fixed="true"/> </xs:restriction> </xs:simpleType> |
xs:anySimpleType
xs:date
none
xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace
This datatype is modeled after the calendar dates defined in Chapter 5.2.1 of ISO 8601. Its value space is the set of Gregorian calendar dates as defined by this standard; i.e., a one-day-long period of time. Its lexical space is the ISO 8601 extended format "[-]CCYY-MM-DD[Z|(+|-)hh:mm]" with an optional timezone. Timezones that are not specified are considered "undetermined."
The basic format of ISO 8601 calendar dates "CCYYMMDD" is not supported.
The other forms of dates available in ISO 8601--ordinal dates defined by the year and the number of the day in the year and dates identified by calendar week and day numbers--are not supported.
As the value space is defined by reference to ISO 8601, there is no support for any calendar system other than Gregorian.
As the lexical space is also defined as reference to ISO 8601, there is no support for any localization such as different orders for date parts or named months.
The order relation between dates with and without timezone is partial: they can be compared only outside of a +/- 14 hours interval.
There is a dissension between ISO 8601 which defines a day as a period of time of 24 hours, and W3C XML Schema, which indicates that a date is a "one-day long, non-periodic instance . . . independent of how many hours this day has." Even though technically right (some days do not last exactly 24 hours because of leap seconds), this definition is not coherent with the definition of xs:duration for which a day is always exactly 24 hours long.
Valid values include: "2001-10-26", "2001-10-26+02:00", "2001-10-26Z", "2001-10-26+00:00", "-2001-10-26", or "-20000-04-01".
The following values would be invalid: "2001-10" (all the parts must be specified), "2001-10-32" (the days part (32) is out of range), "2001-13-26+02:00" (the month part (13) is out of range), or "01-10-26" (the century part is missing).
xs:dateTime | Instant of time (Gregorian calendar). |
<xs:simpleType name="dateTime" id="dateTime"> <xs:restriction base="xs:anySimpleType"> <xs:whiteSpace value="collapse" fixed="true"/> </xs:restriction> </xs:simpleType> |
xs:anySimpleType
xs:dateTime
none
xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace
This datatype describes instants identified by the combination of a date and a time. Its value space is described as a "combination of date and time of day" in Chapter 5.4 of ISO 8601. Its lexical space is the extended format "[-]CCYY-MM-DDThh:mm:ss[Z|(+|-)hh:mm]". The timezone may be specified as "Z" (UTC) or "(+|-)hh:mm." Timezones that are not specified are considered "undetermined."
The basic format of ISO 8601 calendar datetimes "CCYYMMDDThhmmss" is not supported.
The other forms of datetimes available in ISO 8601--ordinal dates defined by the year and the number of the day in the year and dates identified by calendar week and day numbers--are not supported.
As the value space is defined by reference to ISO 8601, there is no support for any calendar system other than Gregorian.
As the lexical space is also defined as reference to ISO 8601, there is no support for any localization such as different orders for date parts or named months.
The order relation between datetimes with and without timezone is partial: they can be compared only outside of a +/- 14 hours interval.
Valid values for xs:dateTime include: "2001-10-26T21:32:52", "2001-10-26T21:32:52+02:00", "2001-10-26T19:32:52Z", "2001-10-26T19:32:52+00:00", "-2001-10-26T21:32:52", or "2001-10-26T21:32:52.12679".
The following values would be invalid: "2001-10-26" (all the parts must be specified), "2001-10-26T21:32" (all the parts must be specified), "2001-10-26T25:32:52+02:00" (the hours part (25) is out of range), or "01-10-26T21:32" (all the parts must be specified).
xs:decimal | Decimal numbers. |
<xs:simpleType name="decimal" id="decimal"> <xs:restriction base="xs:anySimpleType"> <xs:whiteSpace value="collapse" fixed="true"/> </xs:restriction> </xs:simpleType> |
xs:anySimpleType
xs:decimal
xs:integer
xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace
xs:decimal is the datatype that represents the set of all the decimal numbers with arbitrary lengths. Its lexical space allows any number of insignificant leading and trailing zeros (after the decimal point).
The decimal separator is always a point (".") and no thousand separator may be added. There is no support for scientific notations.
Valid values include: "123.456", "+1234.456", "-1234.456", "-.456", or "-456".
The following values would be invalid: "1 234.456" (spaces are forbidden), "1234.456E+2" (scientific notation ("E+2") is forbidden), "+ 1234.456" (spaces are forbidden), or "+1,234.456" (delimiters between thousands are forbidden).
xs:double | IEEE 64 bit floating point. |
<xs:simpleType name="double" id="double"> <xs:restriction base="xs:anySimpleType"> <xs:whiteSpace value="collapse" fixed="true"/> </xs:restriction> </xs:simpleType> |
xs:anySimpleType
xs:double
none
xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace
The value space of xs:double is "double" (64 bits) floating-point numbers as defined by the IEEE. The lexical space uses a decimal format with optional scientific notation. The match between lexical (powers of 10) and value (powers of 2) spaces is approximate and done on the closest value.
This datatype differentiates positive (0) and negative (-0) zeros, and includes the special values "-INF" (negative infinity), "INF" (positive infinity) and "NaN" (Not a Number).
Note that the lexical spaces of xs:float and xs:double are exactly the same; the only difference is the precision used to convert the values in the value space.
The decimal separator is always a point (".") and no thousands separator may be used.
Valid values include: "123.456", "+1234.456", "-1.2344e56", "-.45E-6", "INF", "-INF", or "NaN".
The following values would be invalid: "1234.4E 56" (spaces are forbidden), "1E+2.5" (the power of 10 must be an integer), "+INF" (positive infinity doesn't expect a sign), or "NAN" (capitalization matters in special values).
xs:duration | Time durations. |
<xs:simpleType name="duration" id="duration"> <xs:restriction base="xs:anySimpleType"> <xs:whiteSpace value="collapse" fixed="true"/> </xs:restriction> </xs:simpleType> |
xs:anySimpleType
xs:duration
none
xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace
Durations may be expressed using all the parts of a datetime (from year to fractions of second) and are, therefore, defined as a "six-dimensional space." Note that because the relation between some of these date parts (such as the number of days in a month) is not fixed, the order relationship between durations is only partial and the result of a comparison between two durations may be undetermined.
The lexical space of xs:duration is the format defined by ISO 8601 under the form "PnYnMnDTnHnMnS," in which the capital letters are delimiters and can be omitted when the corresponding member is not used.
Although some durations are undetermined, this is fixed as soon as a starting point is fixed for the duration. W3C XML Schema relies on this feature to define the algorithm to use to compare two durations. Four datetimes have been chosen, which produce the greatest deviations when durations are added. A duration will be considered bigger than another when the result of its addition to these four dates is consistently bigger than the result of the addition of the other duration to these same four datetimes. These datetimes are: "1696-09-01T00:00:00Z", "1697-02-01T00:00:00Z," "1903-03-01T00:00:00Z," and "1903-07-01T00:00:00Z."
The lexical space cannot be customized.
Valid values include "PT1004199059S", "PT130S", "PT2M10S", "P1DT2S", "-P1Y", or "P1Y2M3DT5H20M30.123S".
The following values would be invalid: "1Y" (leading "P" is missing), "P1S" ("T" separator is missing), "P-1Y" (all parts must be positive), "P1M2Y" (parts order is significant and Y must precede M), or "P1Y-1M" (all parts must be positive).
xs:ENTITIES | Whitespace separated list of unparsed entity references. |
<xs:simpleType name="ENTITIES" id="ENTITIES"> <xs:restriction> <xs:simpleType> <xs:list> <xs:simpleType> <xs:restriction base="xs:ENTITY"/> </xs:simpleType> </xs:list> </xs:simpleType> <xs:minLength value="1"/> </xs:restriction> </xs:simpleType> |
xs:ENTITY
none
none
xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:whiteSpace
xs:ENTITIES is derived by a list from xs:ENTITY. It represents lists of unparsed entity references. Each part of this entity reference is a nonqualified name (xs:NCName) and must be declared as an unparsed entity in an internal or external DTD.
Unparsed entities have been defined in XML 1.0 as a way to include non-XML content in a XML document, but most of the applications prefer to define links (such as those defined in (X)HTML to include images or other multimedia objects).
W3C XML Schema does not provide alternative ways to declare unparsed entities. A DTD is needed to do so.
xs:ENTITY | Reference to an unparsed entity. |
<xs:simpleType name="ENTITY" id="ENTITY"> <xs:restriction base="xs:NCName"/> </xs:simpleType> |
xs:NCName
xs:string
xs:ENTITIES
xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace
xs:ENTITY is an entity reference, i.e., a nonqualified name (xs:NCName) that has been declared as an unparsed entity in an internal or external DTD.
Unparsed entities are defined in XML 1.0 as a way to include non-XML content in XML document, but most of the applications prefer to define links (such as those defined in (X)HTML to include images or other multimedia objects).
W3C XML Schema does not provide alternative ways to declare unparsed entities. A DTD is needed to do so.
xs:float | IEEE 32 bit floating point. |
<xs:simpleType name="float" id="float"> <xs:restriction base="xs:anySimpleType"> <xs:whiteSpace value="collapse" fixed="true"/> </xs:restriction> </xs:simpleType> |
xs:anySimpleType
xs:float
none
xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace
The value space of xs:float is "float" (32 bits) floating-point numbers as defined by the IEEE. The lexical space uses a decimal format with optional scientific notation. The match between lexical (powers of 10) and value (powers of 2) spaces is approximate and is done on the closest value.
This datatype differentiates positive (0) and negative (-0) zeros, and includes the special values "-INF" (negative infinity), "INF" (positive infinity), and "NaN" (Not a Number).
Note that the lexical spaces of xs:float and xs:double are exactly the same; the only difference is the precision used to convert the values in the value space.
The decimal separator is always a point (".") and no thousands separator may be added.
Valid values include: "123.456", "+1234.456", "-1.2344e56", "-.45E-6", "INF", "-INF", or "NaN".
The following values would be invalid: "1234.4E 56" (spaces are forbidden), "1E+2.5" (the power of 10 must be an integer), "+INF" (positive infinity doesn't expect a sign), or "NAN" (capitalization matters in special values).
xs:gDay | Recurring period of time: monthly day. |
<xs:simpleType name="gDay" id="gDay"> <xs:restriction base="xs:anySimpleType"> <xs:whiteSpace value="collapse" fixed="true"/> </xs:restriction> </xs:simpleType> |
xs:anySimpleType
xs:gDay
none
xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace
The value space of xs:gDay is the periods of one calendar day recurring each calendar month (such as the third of the month); its lexical space follows the ISO 8601 syntax for such periods (i.e., " -- -DD") with an optional timezone.
When needed, days are reduced to fit in the length of the months, so ---31 would occur on the the 28th of February of nonleap years.
The period (one month) and the duration (one day) are fixed, and no calendars other than the Gregorian are supported.
Valid values include "---01", "---01Z", "---01+02:00", "---01-04:00", "---15", or "---31".
The following values would be invalid: "--30-" (the format must be "---DD"), "---35" (the day is out of range), "---5" (all the digits must be supplied), or "15" (missing leading "---").
xs:gMonth | Recurring period of time: yearly month. |
<xs:simpleType name="gMonth" id="gMonth"> <xs:restriction base="xs:anySimpleType"> <xs:whiteSpace value="collapse" fixed="true"/> </xs:restriction> </xs:simpleType> |
xs:anySimpleType
xs:gMonth
none
xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace
The value space of xs:gMonth is the period of one calendar month recurring each calendar year (such as the month of April); its lexical space should follow the ISO 8601 syntax for such periods (i.e., " -- MM") with an optional timezone. However, there is a typo in the W3C XML Schema Recommendation where the format is defined as " -- MM -- -- . Even though an erratum should be published to bring the W3C XML Schema inline with ISO 8601, most of the current schema processors will expect the (bogus) format " -- MM -- -- . In the example, we follow the correct ISO 8601 format.
The period (one year) and the duration (one month) are fixed, and no calendars other than the Gregorian are supported.
Because of the typo in the W3C XML Schema Specification, users must choose between a bogus format, which works on the current version of the tools, or a correct format, which conforms to ISO 8601.
Valid values include "--05", "--11Z", "--11+02:00", "--11-04:00", or "--02".
The following values would be invalid: "-01-" (the format must be "--MM"), "--13" (the month is out of range), "--1" (both digits must be provided), or "01" (leading " -- " are missing).
xs:gMonthDay | Recurring period of time: yearly day. |
<xs:simpleType name="gMonthDay" id="gMonthDay"> <xs:restriction base="xs:anySimpleType"> <xs:whiteSpace value="collapse" fixed="true"/> </xs:restriction> </xs:simpleType> |
xs:anySimpleType
xs:gMonthDay
none
xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace
The value space of xs:gMonthDay is the period of one calendar day recurring each calendar year (such as the third of April); its lexical space follows the ISO 8601 syntax for such periods (i.e., " -- MM-DD") with an optional timezone.
When needed, days are reduced to fit in the length of the months, so --02-29 would occur on the the 28th of February of nonleap years.
The period (one year) and the duration (one day) are fixed, and no calendars other than the Gregorian are supported.
Valid values include "--05-01", "--11-01Z", "--11-01+02:00", "--11-01-04:00", "--11-15", or "--02-29".
The following values would be invalid: "-01-30-" (the format must be "--MM-DD"), "--01-35" (the day part is out of range), "--1-5" (the leading zeros are missing), or "01-15" (the leading "--" are missing).
xs:gYear | Period of one year. |
<xs:simpleType name="gYear" id="gYear"> <xs:restriction base="xs:anySimpleType"> <xs:whiteSpace value="collapse" fixed="true"/> </xs:restriction> </xs:simpleType> |
xs:anySimpleType
xs:gYear
none
xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace
The value space of xs:gYear is the period of one calendar year (such as the year 2002); its lexical space follows the ISO 8601 syntax for such periods (i.e., "YYYY") with an optional timezone.
The duration (one year) is fixed, and no calendars other than the Gregorian are supported.
Valid values include "2001", "2001+02:00", "2001Z", "2001+00:00", "-2001", or "-20000".
The following values would be invalid: "01" (the century part is missing) or "2001-12" (month parts are forbidden).
xs:gYearMonth | Period of one month. |
<xs:simpleType name="gYearMonth" id="gYearMonth"> <xs:restriction base="xs:anySimpleType"> <xs:whiteSpace value="collapse" fixed="true"/> </xs:restriction> </xs:simpleType> |
xs:anySimpleType
xs:gYearMonth
none
xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace
The value space of xs:gYearMonth is the period of one calendar month (such as the month of February 2002); its lexical space follows the ISO 8601 syntax for such periods (i.e., "YYYY-MM") with an optional timezone.
The duration (one month) is fixed, and no calendars other than the Gregorian are supported.
Valid values include "2001-10", "2001-10+02:00", "2001-10Z", "2001-10+00:00", "-2001-10", or "-20000-04".
The following values would be invalid: "2001" (the month part is missing), "2001-13" (the month part is out of range), "2001-13-26+02:00" (the month part is out of range), or "01-10" (the century part is missing).
xs:hexBinary | Binary contents coded in hexadecimal. |
<xs:simpleType name="hexBinary" id="hexBinary"> <xs:restriction base="xs:anySimpleType"> <xs:whiteSpace value="collapse" fixed="true"/> </xs:restriction> </xs:simpleType> |
xs:anySimpleType
xs:hexBinary
none
xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace
The value space of xs:hexBinary is the set of all binary contents; its lexical space is a simple coding of each octet as its hexadecimal value.
This datatype should not be confused with another encoding called BinHex that is not supported by W3C XML Schema. Other popular binary text encodings (such as uuXXcode, Quote Printable, BinHex, aencode, or base85, to name few) are not supported by the W3C XML Schema.
The expansion factor is high since each binary octet is coded as two characters (i.e., four octets if the document is encoded with UTF-16).
A UTF-8 XML header such as:
"<?xml version="1.0" encoding="UTF-8"?>"
encoded would be:
"3f3c6d78206c657673726f693d6e3122302e20226e656f636964676e223d54552d4622383e3f"
xs:ID | Definition of unique identifiers. |
<xs:simpleType name="ID" id="ID"> <xs:restriction base="xs:NCName"/> </xs:simpleType> |
xs:NCName
xs:string
none
xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace
The purpose of the xs:ID datatype is to define unique identifiers that are global to a document and emulate the ID attribute type available in the XML DTDs.
Unlike their DTD counterparts, W3C XML Schema ID datatypes can be used to define not only attributes, but also simple element content.
For both attributes and simple element content, the lexical domain of these datatypes is the lexical domain of XML nonqualified names (xs:NCName).
Identifiers defined using this datatype are global to a document and provide a way to uniquely identify their containing element, whatever its type and name is.
The constraint added by this datatype beyond the xs:NCName datatype from which it is derived is that the values of all the attributes and elements that have an ID datatype in a document must be unique.
Applications that need to maintain a level of compatibility with DTDs should not use this datatype for elements but should reserve it for attributes.
The lexical domain (xs:NCName) of this datatype doesn't allow the definition of numerical identifiers or identifiers containing whitespaces.
W3C XML Schema provides another mechanism to define unique and key constraints using the xs:unique or xs:key elements when more flexibility is needed.
<xs:element name="book"> <xs:complexType> <xs:sequence> <xs:element name="isbn" type="xs:int"/> <xs:element name="title" type="xs:string"/> <xs:element name="author-ref"> <xs:complexType> <xs:attribute name="ref" type="xs:IDREF" use="required"/> </xs:complexType> </xs:element> <xs:element name="character-refs" type="xs:IDREFS"/> </xs:sequence> <xs:attribute name="identifier" type="xs:ID" use="required"/> </xs:complexType> </xs:element>
xs:IDREF | Definition of references to unique identifiers. |
<xs:simpleType name="IDREF" id="IDREF"> <xs:restriction base="xs:NCName"/> </xs:simpleType> |
xs:NCName
xs:string
xs:IDREFS
xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace
The xs:IDREF datatype defines references to the identifiers defined by the ID datatype and, therefore, emulates the IDREF attribute type of the XML DTDs, even though it can be used for simple content elements as well as for attributes.
The lexical space of xs:IDREF is, like the lexical space of xs:ID, nonqualified XML names (NCName).
The constraint added by this datatype beyond the xs:NCName datatype from which it is derived is the values of all the attributes and elements that have a xs:IDREF datatype must match an ID defined within the same document.
Applications that need to maintain a level of compatibility with DTDs should not use this datatype for elements but should reserve it for attributes.
The lexical domain (NCName) of this datatype doesn't allow definition of numerical key references or references containing whitespaces.
W3C XML Schema provides another mechanism to define key reference constraints using the xs:keyref elements when more flexibility is needed.
<xs:element name="book"> <xs:complexType> <xs:sequence> <xs:element name="isbn" type="xs:int"/> <xs:element name="title" type="xs:string"/> <xs:element name="author-ref"> <xs:complexType> <xs:attribute name="ref" type="xs:IDREF" use="required"/> </xs:complexType> </xs:element> <xs:element name="character-refs" type="xs:IDREFS"/> </xs:sequence> <xs:attribute name="identifier" type="xs:ID" use="required"/> </xs:complexType> </xs:element>
xs:IDREFS | Definition of lists of references to unique identifiers. |
<xs:simpleType name="IDREFS" id="IDREFS"> <xs:restriction> <xs:simpleType> <xs:list> <xs:simpleType> <xs:restriction base="xs:IDREF"/> </xs:simpleType> </xs:list> </xs:simpleType> <xs:minLength value="1"/> </xs:restriction> </xs:simpleType> |
xs:IDREF
none
none
xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:whiteSpace
xs:IDREFS is derived as a list from xs:IDREF and, thus, represents whitespace-separated lists of references to identifiers defined using the ID datatype.
The lexical space of xs:IDREFS is the lexical space of a list of xs:NCName values with a minimum length of one element (xs:IDREFS cannot be empty lists).
xs:IDREFS emulates the xs:IDREFS attribute type of the XML DTDs, even though it can be used to define simple content elements as well as attributes.
Applications that need to maintain a level of compatibility with DTDs should not use this datatype for elements but should reserve it for attributes.
The lexical domain (lists of xs:NCName) of this datatype doesn't allow definition of lists of numerical key references or references containing whitespaces.
Although the W3C XML Schema provides another mechanism to define unique, key, and key reference constraints (using the xs:unique, xs:key, and xs:keyref elements) when more flexibility is needed, this mechanism doesn't provide any alternative for lists of key references (similar to xs:IDREFS).
<xs:element name="book"> <xs:complexType> <xs:sequence> <xs:element name="isbn" type="xs:int"/> <xs:element name="title" type="xs:string"/> <xs:element name="author-ref"> <xs:complexType> <xs:attribute name="ref" type="xs:IDREF" use="required"/> </xs:complexType> </xs:element> <xs:element name="character-refs" type="xs:IDREFS"/> </xs:sequence> <xs:attribute name="identifier" type="xs:ID" use="required"/> </xs:complexType> </xs:element>
xs:int | 32 bit signed integers. |
<xs:simpleType name="int" id="int"> <xs:restriction base="xs:long"> <xs:minInclusive value="-2147483648"/> <xs:maxInclusive value="2147483647"/> </xs:restriction> </xs:simpleType> |
xs:long
xs:decimal
xs:short
xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace
The value space of xs:int is the set of common single size integers (32 bits), i.e., the integers between -2147483648 and 2147483647, its lexical space allows any number of insignificant leading zeros.
The decimal point (even when followed only by insignificant zeros) is forbidden.
-0 and +0 are considered equal, which is different from the behavior of xs:float and xs:double.
Valid values include "-2147483648", "0", "-0000000000000000000005", or "2147483647".
Invalid values include "-2147483649" and "1".
xs:integer | Signed integers of arbitrary length. |
<xs:simpleType name="integer" id="integer"> <xs:restriction base="xs:decimal"> <xs:fractionDigits value="0" fixed="true"/> </xs:restriction> </xs:simpleType> |
xs:decimal
xs:decimal
xs:nonPositiveInteger, xs:long, xs:nonNegativeInteger
xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace
The value space of xs:integer includes the set of all the signed integers, with no restriction on range. Its lexical space allows any number of insignificant leading zeros.
The decimal point (even when followed only by insignificant zeros) is forbidden.
-0 and +0 are considered equal, which is different from the behavior of xs:float and xs:double.
Valid values for xs:integer include "-123456789012345678901234567890", "2147483647", "0", or "-0000000000000000000005".
Invalid values include "1.", "2.6", and "A".
xs:language | RFC 1766 language codes. |
<xs:simpleType name="language" id="language"> <xs:restriction base="xs:token"> <xs:pattern value="([a-zA-Z]{2}|[iI]-[a-zA-Z]+|[xX]-[a-zA-Z]{1,8})(-[a-zA-Z]{1,8})*" /> </xs:restriction> </xs:simpleType> |
xs:token
xs:string
none
xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace
The lexical and value spaces of xs:language are the set of language codes defined by the RFC 1766.
Although the schema for schema defines a minimal test to perform expressed as patterns (see the Definition), the lexical space is the set of existing language codes.
Some valid values for this datatype are: "en", "en-US", "fr", or "fr-FR".
xs:long | 64 bit signed integers. |
<xs:simpleType name="long" id="long"> <xs:restriction base="xs:integer"> <xs:minInclusive value="-9223372036854775808"/> <xs:maxInclusive value="9223372036854775807"/> </xs:restriction> </xs:simpleType> |
xs:integer
xs:decimal
xs:int
xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace
The value space of xs:long is the set of common double-size integers (64 bits), i.e., the integers between -9223372036854775808 and 9223372036854775807; its lexical space allows any number of insignificant leading zeros.
The decimal point (even when followed only by insignificant zeros) is forbidden.
Valid values for xs:long include "-9223372036854775808", "0", "-0000000000000000000005", or "9223372036854775807".
Invalid values include "9223372036854775808" and "1.".
xs:Name | XML 1.O names. |
<xs:simpleType name="Name" id="Name"> <xs:restriction base="xs:token"> <xs:pattern value="\i\c*"/> </xs:restriction> </xs:simpleType> |
xs:token
xs:string
xs:NCName
xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace
The lexical and value spaces of xs:Name are the tokens (NMTOKEN) that conform to the definition of a name in XML 1.0.
Following XML 1.0, those names may contain colons (":"), but no special meaning is attached to these characters. Another datatype (xs:QName) should be used for qualified names when they use namespaces prefixes.
Valid values include "Snoopy", "CMS", or "_1950-10-04_10:00".
Invalid values include "0836217462" (a xs:Name cannot start with a number) or "bold,brash" (commas are forbidden).
xs:NCName | Unqualified names. |
<xs:simpleType name="NCName" id="NCName"> <xs:restriction base="xs:Name"> <xs:pattern value="[\i-[:]][\c-[:]]*"/> </xs:restriction> </xs:simpleType> |
xs:Name
xs:string
xs:ID, xs:IDREF, xs:ENTITY
xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace
The lexical and value spaces of xs:NCName are the names (Name) that conform to the definition of a NCName in the Recommendation "Namespaces in XML 1.0"--i.e., all the XML 1.0 names that do not contain colons (":").
This datatype allows characters such as "-" and may need additional constraints to match the notion of name in your favorite programming language or database system.
Valid values include "Snoopy", "CMS", "_1950-10-04_10-00", or "bold_brash".
Invalid values include "_1950-10-04:10-00" or "bold:brash" (colons are forbidden).
xs:negativeInteger | Strictly negative integers of arbitrary length. |
<xs:simpleType name="negativeInteger" id="negativeInteger"> <xs:restriction base="xs:nonPositiveInteger"> <xs:maxInclusive value="-1"/> </xs:restriction> </xs:simpleType> |
xs:nonPositiveInteger
xs:decimal
none
xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace
The value space of xs:negativeInteger includes the set of all the strictly negative integers (excluding zero), with no restriction of range. Its lexical space allows any number of insignificant leading zeros.
The decimal point (even when followed only by insignificant zeros) is forbidden.
Valid values for xs:negativeInteger include "-123456789012345678901234567890", "-1", or "-0000000000000000000005".
Invalid values include "0" or "-1.".
xs:NMTOKEN | XML 1.0 name token (NMTOKEN). |
<xs:simpleType name="NMTOKEN" id="NMTOKEN"> <xs:restriction base="xs:token"> <xs:pattern value="\c+"/> </xs:restriction> </xs:simpleType> |
xs:token
xs:string
xs:NMTOKENS
xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace
The lexical and value spaces of xs:NMTOKEN are the set of XML 1.0 "name tokens," i.e., tokens composed of characters, digits, ".", ":", "-", and the characters defined by Unicode, such as "combining" or "extender".
This type is usually called a "token."
Valid values include "Snoopy", "CMS", "1950-10-04", or "0836217462".
Invalid values include "brought classical music to the Peanuts strip" (spaces are forbidden) or "bold,brash" (commas are forbidden).
xs:NMTOKENS | List of XML 1.0 name token (NMTOKEN). |
<xs:simpleType name="NMTOKENS" id="NMTOKENS"> <xs:restriction> <xs:simpleType> <xs:list> <xs:simpleType> <xs:restriction base="xs:NMTOKEN"/> </xs:simpleType> </xs:list> </xs:simpleType> <xs:minLength value="1"/> </xs:restriction> </xs:simpleType> |
xs:NMTOKEN
none
none
xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:whiteSpace
xs:NMTOKENS is derived by list from xs:NMTOKEN and represents whitespace-separated lists of XML 1.0 name tokens.
None.
Valid values include "Snoopy", "CMS", "1950-10-04", "0836217462 0836217463", or "brought classical music to the Peanuts strip" (note that, in this case, the sentence is considered as a list of words).
Invalid values include "brought classical music to the "Peanuts" strip" (quotes are forbidden) or "bold,brash" (commas are forbidden).
xs:nonNegativeInteger | Integers of arbitrary length positive or equal to zero. |
<xs:simpleType name="nonNegativeInteger" id="nonNegativeInteger"> <xs:restriction base="xs:integer"> <xs:minInclusive value="0"/> </xs:restriction> </xs:simpleType> |
xs:integer
xs:decimal
xs:unsignedLong, xs:positiveInteger
xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace
The value space of xs:nonNegativeInteger includes the set of all the integers greater than or equal to zero, with no restriction of range. Its lexical space allows any number of insignificant leading zeros.
The decimal point (even when followed only by insignificant zeros) is forbidden.
Valid values include "+123456789012345678901234567890", "0", "0000000000000000000005", or "2147483647".
Invalid values include "1." or "-1.".
xs:nonPositiveInteger | Integers of arbitrary length negative or equal to zero. |
<xs:simpleType name="nonPositiveInteger" id="nonPositiveInteger"> <xs:restriction base="xs:integer"> <xs:maxInclusive value="0"/> </xs:restriction> </xs:simpleType> |
xs:integer
xs:decimal
xs:negativeInteger
xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace
The value space of xs:nonPositiveInteger includes the set of all the integers less than or equal to zero, with no restriction of range. Its lexical space allows any number of insignificant leading zeros.
The decimal point (even when followed only by insignificant zeros) is forbidden.
Valid values include "-123456789012345678901234567890", "0", "-0000000000000000000005", or "-2147483647".
Invalid values include "-1." or "1.".
xs:normalizedString | Whitespace-replaced strings. |
<xs:simpleType name="normalizedString" id="normalizedString"> <xs:restriction base="xs:string"> <xs:whiteSpace value="replace"/> </xs:restriction> </xs:simpleType> |
xs:string
xs:string
xs:token
xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace
The lexical space of xs:normalizedString is unconstrained (any valid XML character may be used), and its value space is the set of strings after whitespace replacement (i.e., after any occurrence of #x9 (tab), #xA (linefeed), and #xD (carriage return) have been replaced by an occurrence of #x20 (space) without any whitespace collapsing).
This is the only datatype that performs whitespace replacement without collapsing. When whitespaces are not significant, xs:token is preferred.
This datatype corresponds to neither the XPath function normalize-space( ) (which performs whitespace trimming and collapsing) nor to the DOM "normalize" method (which is a merge of adjacent text objects).
The value of the element:
<title lang="en"> Being a Dog Is a Full-Time Job </title>"
is the string: " Being a Dog Is a Full-Time Job ", where all the whitespaces have been replaced by spaces if the title element is a type xs:normalizedString.
xs:NOTATION | Emulation of the XML 1.0 feature. |
<xs:simpleType name="NOTATION" id="NOTATION"> <xs:restriction base="xs:anySimpleType"> <xs:whiteSpace value="collapse" fixed="true"/> </xs:restriction> </xs:simpleType> |
xs:anySimpleType
xs:NOTATION
none
xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace
The value and lexical spaces of xs:NOTATION are references to notations declared though the xs:notation element. The use of this element and datatype is, therefore, a namespace-aware emulation of the NOTATION feature of XML 1.0.
Notations are very seldom used in real-world applications.
One cannot use xs:notation directly, but must derive it as shown in the Example.
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:notation name="jpeg" public="image/jpeg" system="file:///usr/bin/xv"/> <xs:notation name="gif" public="image/gif" system="file:///usr/bin/xv"/> <xs:notation name="png" public="image/png" system="file:///usr/bin/xv"/> <xs:notation name="svg" public="image/svg" system="file:///usr/bin/xsmiles"/> <xs:notation name="pdf" public="application/pdf" system="file:///usr/bin/acroread"/> <xs:simpleType name="graphicalFormat"> <xs:restriction base="xs:NOTATION"> <xs:enumeration value="jpeg"/> <xs:enumeration value="gif"/> <xs:enumeration value="png"/> <xs:enumeration value="svg"/> <xs:enumeration value="pdf"/> </xs:restriction> </xs:simpleType> <xs:element name="picture"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:base64Binary"> <xs:attribute name="type" type="graphicalFormat"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:schema>
xs:positiveInteger | Strictly positive integers of arbitrary length. |
<xs:simpleType name="positiveInteger" id="positiveInteger"> <xs:restriction base="xs:nonNegativeInteger"> <xs:minInclusive value="1"/> </xs:restriction> </xs:simpleType> |
xs:nonNegativeInteger
xs:decimal
none
xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace
The value space of xs:positiveInteger includes the set of the strictly positive integers (excluding zero), with no restriction of range. Its lexical space allows any number of insignificant leading zeros.
The decimal point (even when followed only by insignificant zeros) is forbidden.
Valid values include "123456789012345678901234567890", "1", or "0000000000000000000005".
Invalid values include "0" or "1.".
xs:QName | Namespaces in XML qualified names. |
<xs:simpleType name="QName" id="QName"> <xs:restriction base="xs:anySimpleType"> <xs:whiteSpace value="collapse" fixed="true"/> </xs:restriction> </xs:simpleType> |
xs:anySimpleType
xs:QName
none
xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace
The lexical space of xs:QName is the qualified names per Namespace in XML, i.e., a local name (which is a xs:NCName) with an optional prefix (itself a xs:NCName), separated by a colon (":"), where the prefix is declared a namespace prefix in the scope of the element carrying the value. Its value space comprises the pairs (namespace URI, local name) in which the namespace URI is the URI associated to the prefix in the namespace declaration.
This dissociation between lexical and value spaces makes a lot of difference when using facets such as xs:pattern (which acts on the lexical space only and thus constrains the namespace prefix) and xs:enumeration (which acts on the value space and thus constrains the namespace URI).
It is impossible to apply a pattern on the namespace URI.
The usage of QNames in elements and attributes is controversial since it creates a dependency between the content of the document and its markup. However, the official position of the W3C doesn't discourage this practice.
W3C XML Schema itself has already given us some examples of QNames. When we wrote "<xs:attribute name="lang" type="xs:language"/>", the type attribute was a xs:QName and its value was the tuple {"http://www.w3.org/2001/XMLSchema", "language"} because the URI "http://www.w3.org/2001/XMLSchema" had been assigned to the prefix "xs:". If there had been no namespace declaration for this prefix, the type attribute would have been considered invalid.
xs:short | 32 bit signed integers. |
<xs:simpleType name="short" id="short"> <xs:restriction base="xs:int"> <xs:minInclusive value="-32768"/> <xs:maxInclusive value="32767"/> </xs:restriction> </xs:simpleType> |
xs:int
xs:decimal
xs:byte
xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace
The value space of xs:short is the set of common short integers (16 bits), i.e., the integers between -32768 and 32767; its lexical space allows any number of insignificant leading zeros.
The decimal point (even when followed only by insignificant zeros) is forbidden.
Valid values include "-32768", "0", "-0000000000000000000005", or "32767".
Invalid values include "32768" and "1.".
xs:string | Any string. |
<xs:simpleType name="string" id="string"> <xs:restriction base="xs:anySimpleType"> <xs:whiteSpace value="preserve"/> </xs:restriction> </xs:simpleType> |
xs:anySimpleType
xs:string
xs:normalizedString
xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace
The lexical and value spaces of xs:string are the set of all possible strings composed of any character allowed in a XML 1.0 document without any treatment done on whitespaces.
This is the only datatype that leaves all the whitespaces. When whitespaces are not significant, xs:token is preferred.
The value of the following element:
<title lang="en"> Being a Dog Is a Full-Time Job </title>
is the full string "Being a Dog Is a Full-Time Job", with all its tabulations and CR/LF if the title element is a xs:string type .
xs:time | Point in time recurring each day. |
<xs:simpleType name="time" id="time"> <xs:restriction base="xs:anySimpleType"> <xs:whiteSpace value="collapse" fixed="true"/> </xs:restriction> </xs:simpleType> |
xs:anySimpleType
xs:time
none
xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace
The lexical space of xs:time is identical to the time part of xs:dateTime ("hh:mm:ss[Z|(+|-)hh:mm]"); and its value space is the set of points in time recurring daily.
The period (one day) is fixed and no calendars other than the Gregorian are supported.
Valid values include "21:32:52", "21:32:52+02:00", "19:32:52Z", "19:32:52+00:00", or "21:32:52.12679".
Invalid values include "21:32" (all the parts must be specified), "25:25:10" (the hour part is out of range), "-10:00:00" (the hour part is out of range), or "1:20:10" (all the digits must be supplied).
xs:token | Whitespace-replaced and collapsed strings. |
<xs:simpleType name="token" id="token"> <xs:restriction base="xs:normalizedString"> <xs:whiteSpace value="collapse"/> </xs:restriction> </xs:simpleType> |
xs:normalizedString
xs:string
xs:language, xs:NMTOKEN, xs:Name
xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace
The lexical and value spaces of xs:token are the sets of all the strings after whitespace replacement--i.e., after any occurrence of #x9 (tab), #xA (linefeed), and #xD (carriage return) is replaced by an occurrence of #x20 (space) and collapsing (i.e., the contiguous occurrences of spaces are replaced by a single space, and leading and trailing spaces are removed).
More simply said, xs:token is the most appropriate datatype to use for strings that do not care about whitespaces.
The name xs:token is misleading since whitespaces are allowed within xs:token. xs:NMTOKEN is the type corresponding to what is usually called "tokens."
The element:
<title lang="en"> Being a Dog Is a Full-Time Job </title>
is a valid xs:token and its value is the string "Being a Dog Is a Full-Time Job", where all the whitespaces have been replaced by spaces, leading and trailing spaces have been removed and contiguous sequences of spaces have been replaced by single spaces.
xs:unsignedByte | Unsigned value of 8 bits. |
<xs:simpleType name="unsignedByte" id="unsignedBtype"> <xs:restriction base="xs:unsignedShort"> <xs:maxInclusive value="255"/> </xs:restriction> </xs:simpleType> |
xs:unsignedShort
xs:decimal
none
xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace
The value space of xs:unsignedByte is the integers between 0 and 255, i.e., the unsigned values that can fit in a word of 8 bits. Its lexical space allows an optional "+" sign and leading zeros before the significant digits.
The lexical space does not allow values expressed in other numeration bases (such as hexadecimal, octal, or binary).
The decimal point (even when followed only by insignificant zeros) is forbidden.
Valid values include "255", "0", "+0000000000000000000005", or "1".
Invalid values include "-1" and "1.".
xs:unsignedInt | Unsigned integer of 32 bits. |
<xs:simpleType name="unsignedInt" id="unsignedInt"> <xs:restriction base="xs:unsignedLong"> <xs:maxInclusive value="4294967295"/> </xs:restriction> </xs:simpleType> |
xs:unsignedLong
xs:decimal
xs:unsignedShort
xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace
The value space of xs:unsignedInt is the integers between 0 and 4294967295, i.e., the unsigned values that can fit in a word of 32 bits. Its lexical space allows an optional "+" sign and leading zeros before the significant digits.
The decimal point (even when followed only by insignificant zeros) is forbidden.
Valid values include "4294967295", "0", "+0000000000000000000005", or "1".
Invalid values include "-1" and "1.".
xs:unsignedLong | Unsigned integer of 64 bits. |
<xs:simpleType name="unsignedLong" id="unsignedLong"> <xs:restriction base="xs:nonNegativeInteger"> <xs:maxInclusive value="18446744073709551615"/> </xs:restriction> </xs:simpleType> |
xs:nonNegativeInteger
xs:decimal
xs:unsignedInt
xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace
The value space of xs:unsignedLong is the integers between 0 and 18446744073709551615, i.e., the unsigned values that can fit in a word of 64 bits. Its lexical space allows an optional "+" sign and leading zeros before the significant digits.
The decimal point (even when followed only by insignificant zeros) is forbidden.
Valid values include "18446744073709551615", "0", "+0000000000000000000005", or "1".
Invalid values include "-1" and "1.".
xs:unsignedShort | Unsigned integer of 16 bits. |
<xs:simpleType name="unsignedShort" id="unsignedShort"> <xs:restriction base="xs:unsignedInt"> <xs:maxInclusive value="65535"/> </xs:restriction> </xs:simpleType> |
xs:unsignedInt
xs:decimal
xs:unsignedByte
xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace
The value space of xs:unsignedShort is the integers between 0 and 65535, i.e., the unsigned values that can fit in a word of 16 bits. Its lexical space allows an optional "+" sign and leading zeros before the significant digits.
The decimal point (even when followed only by insignificant zeros) is forbidden.
Valid values include "65535", "0", "+0000000000000000000005", or "1".
Copyright © 2002 O'Reilly & Associates. All rights reserved.