Chapter 16. Datatype Reference GuideContents: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. 16.1. Datatypes
Derived from:xs:anySimpleType Primary:xs:anyURI Known subtypes:none Facets:xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace DescriptionThis 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. RestrictionsRelative 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. Example<xs:simpleType name="httpURI"> <xs:restriction base="xs:anyURI"> <xs:pattern value="http://.*"/> </xs:restriction> </xs:simpleType>
Derived from:xs:anySimpleType Primary:xs:base64Binary Known subtypes:none Facets:xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace DescriptionThe 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. RestrictionsRFC 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.) Example<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>
Derived from:xs:anySimpleType Primary:xs:boolean Known subtypes:none Facets:xs:pattern, xs:whiteSpace DescriptionThe 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). RestrictionsThis datatype cannot be localized--for instance, to accept "vrai" and "faux" instead of "true" and "false". Example<book id="b0836217462" available="true"/>
Derived from:xs:short Primary:xs:decimal Known subtypes:none Facets:xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace DescriptionThe 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. RestrictionsThe lexical space does not allow values expressed in other numeration bases (such as hexadecimal, octal, or binary). ExampleValid values for byte include 27, -34, +105, and 0. Invalid values include 0A, 1524, and INF.
Derived from:xs:anySimpleType Primary:xs:date Known subtypes:none Facets:xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace DescriptionThis 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." RestrictionsThe 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. ExampleValid 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).
Derived from:xs:anySimpleType Primary:xs:dateTime Known subtypes:none Facets:xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace DescriptionThis 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." RestrictionsThe 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. ExampleValid 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).
Derived from:xs:anySimpleType Primary:xs:decimal Known subtypes:xs:integer Facets:xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace Descriptionxs: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). RestrictionsThe decimal separator is always a point (".") and no thousand separator may be added. There is no support for scientific notations. ExampleValid 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).
Derived from:xs:anySimpleType Primary:xs:double Known subtypes:none Facets:xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace DescriptionThe 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. RestrictionsThe decimal separator is always a point (".") and no thousands separator may be used. ExamplesValid 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).
Derived from:xs:anySimpleType Primary:xs:duration Known subtypes:none Facets:xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace DescriptionDurations 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." RestrictionsThe lexical space cannot be customized. ExampleValid 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).
Derived from:xs:ENTITY Primary:none Known subtypes:none Facets:xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:whiteSpace Descriptionxs: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. RestrictionsUnparsed 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.
Derived from:xs:NCName Primary:xs:string Known subtypes:xs:ENTITIES Facets:xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace Descriptionxs: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. RestrictionsUnparsed 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.
Derived from:xs:anySimpleType Primary:xs:float Known subtypes:none Facets:xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace DescriptionThe 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. RestrictionsThe decimal separator is always a point (".") and no thousands separator may be added. ExampleValid 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).
Derived from:xs:anySimpleType Primary:xs:gDay Known subtypes:none Facets:xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace DescriptionThe 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. RestrictionsThe period (one month) and the duration (one day) are fixed, and no calendars other than the Gregorian are supported. ExampleValid 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 "---").
Derived from:xs:anySimpleType Primary:xs:gMonth Known subtypes:none Facets:xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace DescriptionThe 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. RestrictionsThe 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. ExampleValid 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).
Derived from:xs:anySimpleType Primary:xs:gMonthDay Known subtypes:none Facets:xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace DescriptionThe 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. RestrictionsThe period (one year) and the duration (one day) are fixed, and no calendars other than the Gregorian are supported. ExampleValid 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).
Derived from:xs:anySimpleType Primary:xs:gYear Known subtypes:none Facets:xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace DescriptionThe 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. RestrictionsThe duration (one year) is fixed, and no calendars other than the Gregorian are supported. ExampleValid 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).
Derived from:xs:anySimpleType Primary:xs:gYearMonth Known subtypes:none Facets:xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace DescriptionThe 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. RestrictionsThe duration (one month) is fixed, and no calendars other than the Gregorian are supported. ExampleValid 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).
Derived from:xs:anySimpleType Primary:xs:hexBinary Known subtypes:none Facets:xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace DescriptionThe 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. RestrictionsThis 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). ExampleA UTF-8 XML header such as: "<?xml version="1.0" encoding="UTF-8"?>" encoded would be: "3f3c6d78206c657673726f693d6e3122302e20226e656f636964676e223d54552d4622383e3f"
Derived from:xs:NCName Primary:xs:string Known subtypes:none Facets:xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace DescriptionThe 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. RestrictionsApplications 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. Example<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>
Derived from:xs:NCName Primary:xs:string Known subtypes:xs:IDREFS Facets:xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace DescriptionThe 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. RestrictionsApplications 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. Example<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>
Derived from:xs:IDREF Primary:none Known subtypes:none Facets:xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:whiteSpace Descriptionxs: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. RestrictionsApplications 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). Example<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>
Derived from:xs:long Primary:xs:decimal Known subtypes:xs:short Facets:xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace DescriptionThe 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. RestrictionsThe 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. ExampleValid values include "-2147483648", "0", "-0000000000000000000005", or "2147483647". Invalid values include "-2147483649" and "1".
Derived from:xs:decimal Primary:xs:decimal Known subtypes:xs:nonPositiveInteger, xs:long, xs:nonNegativeInteger Facets:xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace DescriptionThe 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. RestrictionsThe 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. ExampleValid values for xs:integer include "-123456789012345678901234567890", "2147483647", "0", or "-0000000000000000000005". Invalid values include "1.", "2.6", and "A".
Derived from:xs:token Primary:xs:string Known subtypes:none Facets:xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace DescriptionThe lexical and value spaces of xs:language are the set of language codes defined by the RFC 1766. RestrictionsAlthough 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. ExampleSome valid values for this datatype are: "en", "en-US", "fr", or "fr-FR".
Derived from:xs:integer Primary:xs:decimal Known subtypes:xs:int Facets:xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace DescriptionThe 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. RestrictionsThe decimal point (even when followed only by insignificant zeros) is forbidden. ExampleValid values for xs:long include "-9223372036854775808", "0", "-0000000000000000000005", or "9223372036854775807". Invalid values include "9223372036854775808" and "1.".
Derived from:xs:token Primary:xs:string Known subtypes:xs:NCName Facets:xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace DescriptionThe lexical and value spaces of xs:Name are the tokens (NMTOKEN) that conform to the definition of a name in XML 1.0. RestrictionsFollowing 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. ExampleValid 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).
Derived from:xs:Name Primary:xs:string Known subtypes:xs:ID, xs:IDREF, xs:ENTITY Facets:xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace DescriptionThe 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 (":"). RestrictionsThis datatype allows characters such as "-" and may need additional constraints to match the notion of name in your favorite programming language or database system. ExampleValid 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).
Derived from:xs:nonPositiveInteger Primary:xs:decimal Known subtypes:none Facets:xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace DescriptionThe 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. RestrictionsThe decimal point (even when followed only by insignificant zeros) is forbidden. ExampleValid values for xs:negativeInteger include "-123456789012345678901234567890", "-1", or "-0000000000000000000005". Invalid values include "0" or "-1.".
Derived from:xs:token Primary:xs:string Known subtypes:xs:NMTOKENS Facets:xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace DescriptionThe 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". RestrictionsThis type is usually called a "token." ExampleValid 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).
Derived from:xs:NMTOKEN Primary:none Known subtypes:none Facets:xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:whiteSpace Descriptionxs:NMTOKENS is derived by list from xs:NMTOKEN and represents whitespace-separated lists of XML 1.0 name tokens. RestrictionsNone. ExampleValid 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).
Derived from:xs:integer Primary:xs:decimal Known subtypes:xs:unsignedLong, xs:positiveInteger Facets:xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace DescriptionThe 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. RestrictionsThe decimal point (even when followed only by insignificant zeros) is forbidden. ExampleValid values include "+123456789012345678901234567890", "0", "0000000000000000000005", or "2147483647". Invalid values include "1." or "-1.".
Derived from:xs:integer Primary:xs:decimal Known subtypes:xs:negativeInteger Facets:xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace DescriptionThe 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. RestrictionsThe decimal point (even when followed only by insignificant zeros) is forbidden. ExampleValid values include "-123456789012345678901234567890", "0", "-0000000000000000000005", or "-2147483647". Invalid values include "-1." or "1.".
Derived from:xs:string Primary:xs:string Known subtypes:xs:token Facets:xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace DescriptionThe 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). RestrictionsThis 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). ExampleThe 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.
Derived from:xs:anySimpleType Primary:xs:NOTATION Known subtypes:none Facets:xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace DescriptionThe 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. RestrictionsNotations are very seldom used in real-world applications. One cannot use xs:notation directly, but must derive it as shown in the Example. 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>
Derived from:xs:nonNegativeInteger Primary:xs:decimal Known subtypes:none Facets:xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace DescriptionThe 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. RestrictionsThe decimal point (even when followed only by insignificant zeros) is forbidden. ExampleValid values include "123456789012345678901234567890", "1", or "0000000000000000000005". Invalid values include "0" or "1.".
Derived from:xs:anySimpleType Primary:xs:QName Known subtypes:none Facets:xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace DescriptionThe 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). RestrictionsIt 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. ExampleW3C 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.
Derived from:xs:int Primary:xs:decimal Known subtypes:xs:byte Facets:xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace DescriptionThe 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. RestrictionsThe decimal point (even when followed only by insignificant zeros) is forbidden. ExampleValid values include "-32768", "0", "-0000000000000000000005", or "32767". Invalid values include "32768" and "1.".
Derived from:xs:anySimpleType Primary:xs:string Known subtypes:xs:normalizedString Facets:xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace DescriptionThe 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. RestrictionsThis is the only datatype that leaves all the whitespaces. When whitespaces are not significant, xs:token is preferred. ExampleThe 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 .
Derived from:xs:anySimpleType Primary:xs:time Known subtypes:none Facets:xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace DescriptionThe 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. RestrictionsThe period (one day) is fixed and no calendars other than the Gregorian are supported. ExampleValid 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).
Derived from:xs:normalizedString Primary:xs:string Known subtypes:xs:language, xs:NMTOKEN, xs:Name Facets:xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace DescriptionThe 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. RestrictionsThe name xs:token is misleading since whitespaces are allowed within xs:token. xs:NMTOKEN is the type corresponding to what is usually called "tokens." ExampleThe 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.
Derived from:xs:unsignedShort Primary:xs:decimal Known subtypes:none Facets:xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace DescriptionThe 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. RestrictionsThe 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. ExampleValid values include "255", "0", "+0000000000000000000005", or "1". Invalid values include "-1" and "1.".
Derived from:xs:unsignedLong Primary:xs:decimal Known subtypes:xs:unsignedShort Facets:xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace DescriptionThe 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. RestrictionsThe decimal point (even when followed only by insignificant zeros) is forbidden. ExampleValid values include "4294967295", "0", "+0000000000000000000005", or "1". Invalid values include "-1" and "1.".
Derived from:xs:nonNegativeInteger Primary:xs:decimal Known subtypes:xs:unsignedInt Facets:xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace DescriptionThe 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. RestrictionsThe decimal point (even when followed only by insignificant zeros) is forbidden. ExampleValid values include "18446744073709551615", "0", "+0000000000000000000005", or "1". Invalid values include "-1" and "1.".
Derived from:xs:unsignedInt Primary:xs:decimal Known subtypes:xs:unsignedByte Facets:xs:enumeration, xs:fractionDigits, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:totalDigits, xs:whiteSpace DescriptionThe 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. RestrictionsThe decimal point (even when followed only by insignificant zeros) is forbidden. ExampleValid values include "65535", "0", "+0000000000000000000005", or "1". Copyright © 2002 O'Reilly & Associates. All rights reserved. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|