[2.0] XPath 2.0 Datatypes
XML Schema defines 19 primitive datatypes, and five others (xs:anyAtomicType, xs:untyped, xs:untypedAtomic, xs:dayTimeDuration, and xs:yearMonthDuration) were added to the XML
Schema namespace by the XQuery 1.0 and XPath 2.0 Data Model spec. We’ll
review those briefly here.
XPath 1.0 used the node-set
datatype as its basic data structure; XPath 2.0 uses sequences. Like a
node-set, a
sequence can contain the node types we covered
earlier in this appendix, but it can also contain atomic values of the
types listed here.
Here are the 24 datatypes:
xs:anyAtomicTypeThe base type for all primitive atomic types, such as
xs:integerorxs:string. This datatype was added by XQuery 1.0 and XPath 2.0.xs:anyURIA Uniform Resource Identifier. The value can be absolute or relative, and it can also have a fragment reference identifier. The value should follow the rules for URI syntax as defined in RFC 2396 and amended in RFC 2732.
xs:base64BinaryArbitrary binary data represented using the Base64 alphabet defined in RFC 2045. Legal characters are the basic alpha characters and digits
[a-zA-Z0-9], along with the plus sign (+), the forward slash (/), and the equals sign (=). Anxs:base64Binaryvalue can also contain any number of whitespace characters.xs:booleanThe value
trueorfalse. In XSLT and XPath, the strings"true"and"false"have no special meaning. To generate boolean values, use the functionstrue()andfalse()instead.xs:dateA date with four components: year, month, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access