XML in a Nutshell, Third Edition
xs:anyURI |
The xs:anyURI type indicates a Uniform Resource Identifier. This includes not only Uniform Resource Locators (URLs), but also Uniform Resource Names (URNs). Both relative and absolute URLs are allowed. Legal xs:anyURI values include the following:
-
http://www.cafeaulait.org/
-
http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]/
-
http://www.w3.org/TR/xmlschema-2/#anyURI
-
#xpointer(/book/chapter%5B20%5D/sect1%5B2%5D)
-
gopher://spinaltap.micro.umn.edu/00/Weather/
-
mailto:elharo@metalab.unc.edu
-
chapters/ch03.html
-
http:// ibiblio .org/nywc/compositions. phtml ?category=Concertos
More specifically , elements of this type must be composed exclusively of the ASCII letters A-Z and a-z and digits 0-9, as well as the ASCII punctuation marks -, _, ., !, ~, *, `, (, and). In addition, the ASCII punctuation marks ;, /, ?, :, @, &, =, +, $, %, [, ], and , may be used for their intended purposes in URLs; e.g., the forward slash can be used as the path separator but not as part of a filename. All other characters must be escaped by encoding each byte of their UTF-8 representation as a percent sign followed by the hexadecimal value of the character. Although there are other restrictions on what does and does not make a legal URI, in practice, the only conditions that schema processors check are the limitations on the characters that may appear.
Constraining facets that apply to xs:anyURI are length , minLength , maxLength , pattern , enumeration , and whiteSpace .
xs:base64Binary |
The xs:base64Binary type represents an arbitrary sequence of bytes that has been encoded in ASCII characters using the Base-64 algorithm defined in RFC 2045, Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies . The letters A-Z and a-z, the digits 0-9, and the punctuation marks + and / are used to encode data according to an algorithm that maps four of these characters to three arbitrary bytes. The equals sign is used to pad data at the end if necessary.
The constraining facets that apply to xs:base64Binary are length , minLength , maxLength , pattern , enumeration , and whiteSpace . Unlike string types, the values specified by the length , minLength , and maxLength facets refer to the number of bytes in the decoded data, not to the number of characters in the encoded data.
xs:boolean |
The xs:boolean type represents a logical Boolean whose value is either true or false. There are exactly four legal values for elements and attributes whose type is Boolean:
-
true
-
false
-
-
1
0is the same as false, and 1 is the same as true. Only two constraining facets apply to xs:boolean : pattern and whiteSpace .
xs:byte |
The xs:byte type represents an integer with a value between -128 and 127. It is a subtype of the xs:short type. Legal values include any sequence of digits whose value is less than or equal to 127 and greater than or equal to -128. An optional leading plus or minus sign is allowed. For example, these are legal bytes:
-
127
-
-128
-
-
52
-
+52
-
0000052
Constraining facets that apply to xs:byte are length , minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , whiteSpace , and totalDigits .
xs:date |
The xs:date type represents a specific day in history such as September 26, 2005. Dates are written in the form CCYY - MM - DD . For example, September 26, 2005 is written as 2005-09-26 . Dates in the far future and distant past can be written with more than four digits in the year, but at least four digits are required. Dates before year 1 are written with a preceding minus sign. (There was no year 0.) An optional time zone indicator in the form hh:mm may be suffixed to provide a time zone as an offset from Coordinated Universal Time (Greenwich Mean Time, UTC). For example, 2005-09-26-05:00 is September 26, 2005 in the U.S. Eastern time zone. A Z can be used instead to indicate UTC. These are all valid values of type xs:date :
-
2001-01-01
-
1999-12-31Z
-
0482-11-24
-
-0052-10-23
-
2002-12-23+12:00
-
87500-01-01
Constraining facets that apply to xs:date are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , and whiteSpace . Note, however, that when the time zone is not specified, it's not always possible to determine unambiguously whether one date begins after another.
xs:dateTime |
The xs:dateTime type represents a specific moment in history, such as 3:32 P.M., September 26, 2003. Date-times are written in the form CCYY - MM - DD T hh : mm : ss . For example, 3:32 P.M., September 26, 2003 is written as 2003-09-26T15:32:00 . Decimal fractions of a second can be indicated by appending a period and any number of digits after the seconds. Dates in the far future and distant past can be written with more than four digits in the year, but at least four digits are required. Dates before year 1 are written with a preceding minus sign. (There was no year 0.) An optional time zone indicator in the form hh:mm may be suffixed to provide a time zone as an offset from Coordinated Universal Time (Greenwich Mean Time, UTC). For example, 2003-09-26T15:32:00-05:00 is 3:32 P.M., September 26, 2003 in the U.S. Eastern time zone. A Z can be used instead to indicate UTC. These are all valid values of type xs:dateTime :
-
2001-01-01T03:32:00-05:00
-
1999-12-31T00:00:00Z
-
2002-12-23T17:08:30.121893632178
Constraining facets that apply to xs:dateTime are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , and whiteSpace . Note, however, that when the time zone is not specified, it's not always possible to unambiguously determine whether one time falls after another.
xs:decimal |
xs:decimal is the base type for all numeric built-in schema types, except xs:float and xs:double . It represents a base 10 number with any finite number of the digits 0-9 before and after the decimal point. It may be prefixed with either a plus sign or a minus sign. These are all valid values of type xs:decimal :
-
3.1415292
-
03.1415292
-
127
-
+127
-
-128
-
0.0
-
.
-
.0
This type is not conducive to localization. Only European digits can be used, and only a period can be used as a decimal point. Exponential and scientific notation are not supported.
Constraining facets that apply to xs:decimal are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , whiteSpace , fractionDigits , and totalDigits .
xs:double |
The xs:double type is designed to represent eight-byte, binary floating-point numbers in IEEE 754 format, such as is used by the double type in Java and many C compilers. This includes the special values INF for infinity and NaN for not a number, used for the results of unconventional operations like dividing by zero and taking the square root of a negative number. Because not all binary numbers can be precisely represented by decimal numbers, it is possible that two different decimal representations in the lexical space map to the same value (and vice versa). In this case, the closest approximation IEEE-754 value is chosen . These are all legal values of type xs:double :
-
3.1415292
-
-03.1415292
-
6.022E23
-
127E-13
-
+2.998E+10
-
-128e12
-
0.0
-
INF
-
NaN
-
-INF
Constraining facets that apply to xs:double are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , and whiteSpace .
xs:duration |
The xs:duration type represents a length of time such as 15 minutes; 2 hours; or 3 years , 7 months, 2 days, 8 hours, 32 minutes, and 12 seconds. It does not have a specific beginning or end, just a length. Durations are represented using the ISO-8601 standard format P n Y n M n DT n H n M n S . n Y gives the number of years, n M the number of months, n D the number of days, n H the number of hours, n M the number of minutes, and n S the number of seconds. The number of years, months, days, hours, minutes, and seconds are all given as nonnegative integers. The number of seconds is a decimal number with as many places after the decimal point as necessary. For example, in this format, 3 years, 7 months, 2 days, 8 hours, 32 minutes, and 12 seconds is written as P3Y7M2DT8H32M12S . Any values that are zero can be omitted. Thus, a duration of 2 years and 2 minutes can be written as P2YT2M . If there are no hours, minutes, or seconds, then the T is omitted. Thus, a duration of two years is written as P2Y . A leading minus sign before the P indicates a negative duration.
Constraining facets that apply to xs:duration are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , and whiteSpace . However, because the number of days in a month varies from 28 to 31 and the number of days in a year varies from 365 to 366, durations are not always perfectly ordered. For instance, whether P1M is greater than, equal to, or less than P30D depends on which month it is.
xs:ENTITIES |
The xs:ENTITIES type indicates that the value is a whitespace-separated list of XML 1.0 unparsed entity names declared in the instance document's DTD. This is the same as the DTD ENTITIES attribute type.
Constraining facets that apply to xs:ENTITIES are length , minLength , maxLength , enumeration , pattern , and whiteSpace . The length , minLength , and maxLength facets all refer to the number of entity names in the list.
xs:ENTITY |
The xs:ENTITY type is a subtype of xs:NCNAME with the additional restriction that the value be declared as an unparsed entity in the document's DTD. The legal lexical values of type xs:ENTITY are exactly the same as for xs:NCNAME . Constraining facets that apply to xs:ENTITY are length , minLength , maxLength , pattern , enumeration , and whiteSpace .
|
xs:float |
The xs:float type represents four-byte, binary floating-point numbers in IEEE-754 format, such as is the float type in Java and many C compilers. This includes the special values INF for infinity and NaN for not a number, used for the results of unconventional operations like dividing by zero and taking the square root of a negative number. Because not all binary numbers can be precisely represented by decimal numbers, it is possible that two different decimal representations in the lexical space map to the same value (and vice versa). In this case, the closest approximation of the IEEE-754 value is chosen. These are all legal values of type xs:float :
-
3.1415292
-
-03.1415292
-
6.022E23
-
127E-13
-
+2.998E+10
-
-128e12
-
0.0
-
INF
-
NaN
-
-INF
Constraining facets that apply to xs:float are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , and whiteSpace .
xs:gDay |
The xs:gDay type represents a certain day of the month such as the 14th or the 23rd in no particular month. The format used is - DD plus an optional time zone suffix in the form hh:mm or Z to indicate Coordinated Universal Time (UTC). These are all valid xs:gDay values:
-
---01
-
---28
-
---29Z
-
---31+02:00
-
---15-11:00
The g indicates that the day is given in the Gregorian calendar. Schema date types are not localizable to non-Gregorian calendars. If you need a different calendar, you'll need to derive from xs:string using the pattern facet.
Constraining facets that apply to xs:gDay are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , and whiteSpace . However, if the time zones are not specified, it may not be possible to conclusively determine whether one day is greater than or less than another. If time zones are specified, days are compared by when they start. Thus ---29-05:00 is greater than ---29Z , which is greater than ---29+02:00 .
xs:gMonth |
The xs:gMonth type represents a certain month of the year in the Gregorian calendar as an integer between --01 and --12 . An optional time zone suffix in the form hh:mm or Z to indicate Coordinated Universal Time (UTC) can be added as well. These are all valid xs:gMonth values:
-
- -01
-
--12
-
--12Z
-
--09+02:00
-
--03-11:00
|
The g indicates that the month is given using the Gregorian calendar. Schema date types are not localizable to non-Gregorian calendars. If you need a different calendar, you'll need to derive from xs:string using the pattern facet.
Constraining facets that apply to xs:gMonth are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , and whiteSpace . However, if the time zones are not specified, it may not be possible to determine conclusively whether one month starts before another. If time zones are specified, months are compared by their first moment. Thus, --12-05:00 is greater than --12-Z , which is greater than --12+02:00 .
xs:gMonthDay |
The xs:gMonthDay type represents a certain day of a certain month in no particular year. It is written in the format MM - DD , plus an optional time zone suffix in the form hh:mm or Z to indicate Coordinated Universal Time (UTC). These are all valid xs:gMonthDay values:
-
--10-31
-
--12-25Z
-
--01-01+05:00
-
--07-04-02:00
The g indicates that the month and day are specified in the Gregorian calendar. Schema date types are not localizable to non-Gregorian calendars. For a different calendar, you'll have to derive from xs:string using the pattern facet.
Constraining facets that apply to xs:gMonthDay are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , and whiteSpace . However, if the time zones are not specified, it is not always possible to determine conclusively whether one day starts before another. If time zones are specified, days are compared by their first moment in the same year.
xs:gYear |
The xs:gYear type represents a year in the Gregorian calendar. It is written in the format CCYY , plus an optional time zone suffix in the form hh:mm or Z to indicate Coordinated Universal Time (UTC). Dates before year 1 can be indicated by a preceding minus sign. At least four digits are used, but additional digits can be added to indicate years after 9999 or before 9999 BCE. These are all valid xs:gYear values in their order of occurrence:
-
-15000000000
-
0004
-
0600
-
1492
-
2002+10:00
-
2004Z
-
2004-04:30
-
100000
-
800000000
Constraining facets that apply to xs:gYear are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , and whiteSpace . However, if the time zones are not specified, it may not be possible to determine conclusively whether one year starts before another. If time zones are specified, years are compared by their first moment.
xs:gYearMonth |
The xs:gYearMonth type represents a month and year in the Gregorian calendar, such as March, 2005. It is written in the format CCYY-MM , plus an optional time zone suffix in the form
-
- 15000000000-05
-
0004-04
-
0600-10
-
1492-11
-
2005-03+10:00
-
2005-03Z
-
2005-03-04:30
-
100000-07
-
100000-08
Constraining facets that apply to xs:gYearMonth are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , and whiteSpace . However, if the time zones are not specified, it may not be possible to determine conclusively whether one month and year starts before another.
xs:hexBinary |
The xs:hexBinary type represents an arbitrary sequence of bytes that has been encoded by replacing each byte of data with two hexadecimal digits from 0 through F (A is 10, B is 11, C is 12, etc.). Either upper- or lowercase letters may be used in whatever character set the document is written. In UTF-8 or ASCII, this has the effect of exactly doubling the space used for the data.
The constraining facets that apply to xs:hexBinary are length , minLength , maxLength , pattern , enumeration , and whiteSpace . Unlike string types, the values specified by the length , minLength , and maxLength facets refer to the number of bytes in the decoded data, not to the number of characters in the encoded data.
xs:ID |
xs:ID is a subtype of xs:NCName with the additional restriction that the value is unique among other items of type xs:ID within the same document. The legal lexical values of type xs:ID are exactly the same as for xs:NCName . Constraining facets that apply to xs:ID are length , minLength , maxLength , pattern , enumeration , and whiteSpace .
xs:IDREF |
xs:IDREF is a subtype of xs:NCName , with the additional restriction that the value is used elsewhere in the instance document on an item with type xs:ID . The legal lexical values of type xs:IDREF are exactly the same as for xs:NCName . Constraining facets that apply to xs:IDREF are length , minLength , maxLength , pattern , enumeration , and whiteSpace .
xs:IDREFS |
The xs:IDREFS type indicates that the value is a whitespace-separated list of xs:ID type values used elsewhere in the instance document. This is similar to the DTD IDREFS attribute type.
Constraining facets that apply to xs:IDREFS are length , minLength , maxLength , enumeration , pattern , and whiteSpace . The length , minLength , and maxLength facets all refer to the number of IDREFs in the list.
xs:int |
The xs:int type represents a signed integer small enough to be represented as a four-byte, two's complement number, such as Java's int primitive data type. It is derived from xs:long by setting the maxInclusive facet to 2147483647 and the minInclusive facet to -2147483648. These are all legal values of type xs:int :
-
200
-
200000
-
-200000
-
+2147483647
-
-2147483648
-
Constraining facets that apply to xs:int are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , whiteSpace , and totalDigits .
xs:integer |
The xs:integer type represents a mathematical integer of arbitrary size . The type is derived from xs:double by fixing the fractionDigits facet at 0. It may be prefixed with either a plus sign or a minus sign. If no sign is present, a plus is assumed. These are all legal values of type xs:integer :
-
3
-
3000
-
349847329847983261983264900732648326487324678346374
-
+127
-
-128
-
-
+0
-
-0
Constraining facets that apply to xs:integer are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , whiteSpace , and totalDigits .
xs:language |
Elements and attributes with type xs:language contain a language code as defined in RFC 1766, Tags for the Identification of Languages . These are essentially the acceptable values for the xml:lang attribute described in Chapter 5. If possible, this should be one of the two-letter language codes defined in ISO 639, possibly followed by a country code. For languages that aren't listed in ISO 639, you can use one of the i-codes registered with IANA. If the language you need isn't present in either of these sets, you can make up your own language tag beginning with the prefix "x-" or "X-". Thus, these are acceptable language values:
-
en
-
en-US
-
en-GB
-
fr-CA
-
i-klingon
-
x-quenya
-
X-PigLatin
Constraining facets that apply to xs:language are length , minLength , maxLength , pattern , enumeration , and whiteSpace .
xs:long |
The xs:long type represents a signed integer that can be represented as an eight-byte, two's complement number, such as Java's long primitive data type. It is derived from xs:integer by setting the maxInclusive facet to 9223372036854775807 and the minInclusive facet to -9223372036854775808. These are all legal values of type xs:long :
-
2
-
200
-
+9223372036854775807
-
-9223372036854775808
-
5000000000
-
Constraining facets that apply to xs:long are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , whiteSpace , and totalDigits .
xs: Name |
xs:Name is a subtype of xs:token that is restricted to legal XML 1.0 names. In other words, the value must consist exclusively of letters, digits, ideographs, and the underscore , hyphen, period, and colon . Digits, the hyphen, and the period may not be used to start a name, although they may be used inside the name. These are all legal values of type xs:Name :
-
G127
-
_128
-
Limit
-
xml-stylesheet
-
svg:rect
-
-
Constraining facets that apply to xs:Name are length , minLength , maxLength , pattern , enumeration , and whiteSpace .
XML 1.1 names that are not legal XML 1.0 names are not allowed. At the time of this writing, the schema working group has not yet decided how or when to update the schema specification to account for the changes in name rules in XML 1.1. They may issue an erratum to the schemas specification, or they may wait until Version 1.1 of the W3C XML Schema specification is published.
xs:NCName |
An xs:NCName is a noncolonized name as defined in "Namespaces in XML" 1.0. This is a legal XML name that does not contain a colon. The value must consist exclusively of letters, digits, ideographs, and the underscore, hyphen, and period. Digits, the hyphen, and the period may not be used to start a name, although they may be used inside the name. Name characters allowed in XML 1.1 but not in XML 1.0, such as the Ethiopic alphabet, are not allowed. These are all legal values of type xs:NCName :
-
I-10
-
_128
-
Limit
-
xml-stylesheet
-
Constraining facets that apply to xs:NCName are length , minLength , maxLength , pattern , enumeration , and whiteSpace .
xs:negativeInteger |
The xs:negativeInteger type represents a mathematical integer that is strictly less than zero. It is derived from xs:integer by setting the maxInclusive facet to -1. These are all legal values of type xs:negativeInteger :
-
- 2
-
-200
-
-9223372036854775809
-
-9223372036854775808922337203685477580892233720368
-
-34
Constraining facets that apply to xs:negativeInteger are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , whiteSpace , and totalDigits .
xs:NMTOKEN |
An xs:NMTOKEN is the schema equivalent of the DTD NMTOKEN attribute type. It is a subtype of xs:token that is restricted to legal XML 1.0 name tokens. These are the same as XML 1.0 names except that there are no restrictions on what characters may be used to start the name token. XML 1.1 names are only allowed if they are also XML 1.0 names. In other words, the value must consist of one or more letters, digits, ideographs, and the underscore, hyphen, period, and colon. These are all legal values of type xs:NMTOKEN :
-
127
-
-128
-
Limit
-
integration
-
svg:rect
-
-
Constraining facets that apply to xs:NMTOKEN are length , minLength , maxLength , pattern , enumeration , and whiteSpace .
xs:NMTOKENS |
The xs:NMTOKENS type is the schema equivalent of the DTD NMTOKENS attribute type. xs:NMTOKENS is derived from xs:NMTOKEN by list. Thus, a value of type xs:NMTOKENS contains one or more whitespace-separated XML 1.0 name tokens. These are all legal values of type xs:NMTOKENS :
-
127 126 125 124 123 122 121 120 119 118
-
-128
-
Limit Integral Sum Sup Liminf Limsup
-
Jan Feb Mar Apr May June July Sept Nov Dec
-
svg:rect
Constraining facets that apply to xs:NMTOKENS are length , minLength , maxLength , enumeration , pattern , and whiteSpace . The length , minLength , and maxLength facets all refer to the number of name tokens in the list.
xs:nonNegativeInteger |
The xs:nonNegativeInteger type represents a mathematical integer that is greater than or equal to zero. It is derived from xs:integer by setting the minInclusive facet to 0. These are all legal values of type xs:nonNegativeInteger :
-
2
-
+200
-
9223372036854775809
-
9223372036854775808922337203685477580892233720368
-
Constraining facets that apply to xs:nonNegativeInteger are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , whiteSpace , and totalDigits .
xs:nonPositiveInteger |
The xs:nonPositiveInteger type represents a mathematical integer that is less than or equal to zero. It is derived from xs:integer by setting the maxInclusive facet to 0. These are all legal values of type xs:nonPositiveInteger :
-
-2
-
-200
-
-9223372036854775809
-
-9223372036854775808922337203685477580892233720368
-
Constraining facets that apply to xs:nonPositiveInteger are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , whiteSpace , and totalDigits .
xs:normalizedString |
xs:normalizedString is derived from xs:string by setting the whiteSpace facet to replace so that the carriage return (#xD) and tab (#x9) characters are replaced by spaces in the normalized value. (The new whitespace characters added in XML 1.1, NEL and line separator, are not affected.) A normalized string can contain any characters that are allowed in XML, although depending on context, special characters such as < , & , and " may have to be escaped with character or entity references in the usual way. All legal strings are also legal lexical representations of type xs:normalizedString . However, a schema-aware parser that presents the normalized value of an element, instead of the literal characters in the document, will replace all carriage returns and tabs with spaces before passing the string to the client application.
Constraining facets that apply to xs:normalizedString are length , minLength , maxLength , pattern , enumeration , and whiteSpace .
xs:NOTATION |
The xs:NOTATION type restricts a value to those qualified names declared as notations using an xs:notation element in the schema. This is an abstract type. In other words, you cannot directly declare that an element or attribute has type xs:NOTATION . Instead, you must first derive a new type from xs:NOTATION , most commonly by enumeration, and then declare that your element or attribute possesses the subtype. Constraining facets that apply to xs:NOTATION are length , minLength , maxLength , pattern , enumeration , and whiteSpace .
xs:positiveInteger |
The xs:positiveInteger type represents a mathematical integer that is strictly greater than zero. It is derived from xs:integer by setting the minInclusive facet to 1. These are all legal values of type xs:positiveInteger :
-
1
-
+2
-
9223372036854775809
-
9223372036854775808922337203685477580892233720368
-
34
Constraining facets that apply to xs:positiveInteger are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , whiteSpace , and totalDigits .
xs:QName |
An xs:QName is a base type that is restricted to namespace-qualified names. The logical value of a qualified name is a namespace URI, local part pair. Lexically, qualified names are the same as XML 1.0 names except that they may not contain more than one colon and that colon may not be the first character in the name. A qualified name may or may not be prefixed. If it is prefixed, then the prefix must be properly mapped to a namespace URI. If it is not prefixed, then the name must occur in the scope of a default namespace. These are all legal values of type xs:QName , provided that this condition is met in context:
-
xsl:apply-templates
-
svg:rect
-
limit
-
xml:lang
-
body
-
xlink:href
Constraining facets that apply to xs:QName are length , minLength , maxLength , pattern , enumeration , and whiteSpace .
xs:short |
The xs:short type indicates a signed integer small enough to be represented as a two-byte, two's complement number such as Java's short primitive data type. It is derived from xs:int by setting the maxInclusive facet to 32767 and the minInclusive facet to -32768. These are all legal values of type xs:int :
-
2000
-
+2000
-
-2000
-
32767
-
-32768
-
Constraining facets that apply to xs:short are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , whiteSpace , and totalDigits .
xs:string |
This is the most general simple type. Elements and attributes with type xs:string can contain any sequence of characters allowed in XML, although depending on context, certain characters such as < , & , and " may have to be escaped with character or entity references in the usual way.
Constraining facets that apply to xs:string are length , minLength , maxLength , pattern , enumeration , and whiteSpace .
xs:time |
The xs:time type represents a specific time of day on no particular day, such as 3:32 P.M. Times are written in the form hh:mm:ss.xxx using a 24- hour clock and as many fractions of a second as necessary. For example, 3:41 P.M. is written as 15:41:00 . 3:41 A.M. and 0.5 seconds is written as 03:41:00.5 . The Z suffix indicates Coordinated Universal Time (Greenwich Mean Time, UTC). Otherwise, the time zone can be indicated as an offset in hours and minutes from UTC. For example, 15:41:00-05:00 is 3:41 P.M., in the U.S. Eastern time zone. The time zone may be omitted, in which case the actual time is somewhat nondeterministic. These are all valid values of type xs:time :
-
03:32:00-05:00
-
00:00:00Z
-
08:30:34.121893632178
-
23:59:59
Constraining facets that apply to xs:time are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , and whiteSpace . Note, however, that when the time zone is not specified, it's not always possible to determine unambiguously whether one time falls after another.
xs:token |
xs:token is a subtype of xs:normalizedString whose normalized value does not contain any line feed (#xA) or tab (#x9) characters, does not have any leading or trailing whitespace (as whitespace is defined by XML 1.0, not XML 1.1), and has no sequence of two or more spaces. All legal strings are also legal lexical representations of type xs:token . However, a schema-aware parser that presents the normalized value of an element instead of the literal characters in the document will trim leading and trailing whitespace and compress all other runs of whitespace characters with a single space before passing the string to the client application.
Constraining facets that apply to xs:token are length , minLength , maxLength , pattern , enumeration , and whiteSpace .
xs:unsignedByte |
The xs:unsignedByte type represents a nonnegative integer that can be stored in one byte, such as the unsigned char type used by some (but not all) C compilers. It is derived from xs:unsignedShort by setting the maxInclusive facet to 255 (2 8 -1). These are all legal values of type xs:unsignedByte :
-
3
-
200
-
+255
-
50
-
Constraining facets that apply to xs:unsignedByte are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , whiteSpace , and totalDigits .
xs:unsignedInt |
The xs:unsignedInt type represents a nonnegative integer that can be stored in four bytes, such as the unsigned int type used by some C compilers. It is derived from xs:unsignedLong by setting the maxInclusive facet to 4294967295 (2 32 -1). These are all legal values of type xs:unsignedInt :
-
2
-
200
-
+4294967295
-
100000
-
Constraining facets that apply to xs:unsignedInt are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , whiteSpace , and totalDigits .
xs:unsignedLong |
The xs:unsignedLong type represents a nonnegative integer that can be stored in eight bytes, such as the unsigned long type used by some C compilers. It is derived from xs:nonNegativeInteger by setting the maxInclusive facet to 18446744073709551615 (2 64 -1). These are all legal values of type xs:unsignedLong :
-
2
-
200
-
+9223372036854775807
-
18446744073709551615
-
5000000000
-
Constraining facets that apply to xs:unsignedLong are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , whiteSpace , and totalDigits .
xs:unsignedShort |
The xs:unsignedShort type represents a nonnegative integer that can be stored in two bytes, such as the unsigned short type used by some C compilers. It is derived from xs:unsignedInt by setting the maxInclusive facet to 65535 (2 16 -1). These are all legal values of type xs:unsignedShort :
-
3
-
300
-
+65535
-
50000
-
Constraining facets that apply to xs:unsignedShort are minInclusive , maxInclusive , minExclusive , maxExclusive , pattern , enumeration , whiteSpace , and totalDigits .