Appendix B. Built-in Types

This appendix describes all the types that are built into XQuery via the XML Schema specification. For each type, it describes the set of valid values, as well as notes on comparing and casting values of these types.


The type xs:anyAtomicType is a generic type that encompasses all atomic types, both primitive and derived, including xs:untypedAtomic. No values ever actually have the type xs:anyAtomicType; they always have a more specific type. As such, it does not have a corresponding constructor.

However, this type name can be used as a placeholder for all other atomic types in function signatures and sequence types. For example, the distinct-values function signature specifies that its argument is xs:anyAtomicType. This means that atomic values of any type can be passed to this function.


The type xs:anySimpleType represents the base type of all simple types (atomic, list, and union types) in the type hierarchy. In the context of XQuery, xs:anySimpleType is abstract and is never used directly. For example, it is not possible to cast values to or from this type, or use this type name in a user-defined function signature.


The type xs:anyType is given to some element nodes without a more specific type. The difference between xs:anyType and xs:untyped is that an element of type xs:anyType may contain other elements that have specific types. Elements of type xs:untyped, on the other hand, always have children that are ...

Get XQuery, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.