Pre-defined types

Most pre-defined types are defined in the XSD but the XDM and XPath specifications augment these with additional types, such as:

For more detailed information about types, see:

Table of pre-defined types

The table below is an attempt to create an alphabetical list of all the types, how they relate to each other and the categories they are formally or colloquially assigned to in the specification documents.

There are two main categories of pre-defined type: schema types (which are mostly prefixed with xs:) and item types (which are suffixed with a pair of round brackets). In the table below, additional categories are listed. These are classes of type defined in one or more the specifications; see abbreviations brackets.

From XPath 4.0, for the purpose of comparing atomic items, the primitive atomic types are divided into a number of comparison families: atomic items belonging to types in the same family are mutually comparable, items belonging to different type families are not.

Name Description Category Parent type Sub-types Comparison family Notes

xs:anyAtomicType

A generalisation, representing any atomic item type.

  • Schema (XSD, XDM)
  • Special (XSD)
  • Atomic
  • Generalized Atomic (XPath)
  • Abstract (XPath)

xs:anySimpleType

xs:anyURI, xs:base64Binary, xs:boolean, xs:date, xs:dateTime, xs:decimal, xs:double, xs:duration, xs:float, xs:gDay, xs:gMonth, xs:gMonthDay, xs:gYear, xs:gYearMonth, xs:hexBinary, xs:NOTATION, xs:QName, xs:string, xs:time, xs:untypedAtomic

 

Introduced in XDM 3.0.

Sources: [1], [4], [10], [11], [13], [14]

xs:anySimpleType

A restriction of xs:anyType to just all atomic values and all finite-length lists of zero or more atomic values.

  • Schema (XSD)
  • Special (XSD)
  • Abstract (XPath)

xs:anyType

xs:anyAtomicType, list, union

 

Introduced in XDM 3.0.

Sources: [1], [10], [13]

xs:anyType

A generalisation that represents all datatypes.

  • Schema (XSD)
  • Ordinary
  • Abstract (XPath)

xs:anySimpleType, sequence

 

Sources: [1], [6], [13]

xs:anyURI

An Internationalized Resource Identifier Reference (IRI).

  • Schema (XSD, XDM)
  • Primitive
  • Atomic
  • Generalized Atomic (XPath)

xs:anyAtomicType

String-like

Sources: [1], [3], [4], [11], [14]

array()

An array.

  • Item (XPath)

function()

Function

For more information, see Arrays.

Sources: [22]

attribute()

An XML attribute.

  • Item (XPath)

node()

schema-attribute()

Attribute

Sources: [22]

xs:base64Binary

Arbitrary Base64-encoded binary data.

  • Schema (XSD, XDM)
  • Primitive
  • Atomic
  • Generalized Atomic (XPath)

xs:anyAtomicType

Binary

Sources: [1], [3], [4], [11], [14]

xs:boolean

The values true or false.

  • Schema (XSD, XDM)
  • Primitive
  • Atomic
  • Generalized Atomic (XPath)

xs:anyAtomicType

Boolean

Sources: [1], [3], [4], [11], [14]

xs:byte

A generalized atomic type.

  • Schema (XSD)
  • Atomic
  • Generalized Atomic (XPath)
  • Ordinary

xs:short

Numeric

Sources: [1], [4], [6], [14]

comment()

An XML comment.

  • Item (XPath)

node()

Comment

Sources: [22]

xs:date

An entire calendar day.

  • Schema (XSD, XDM)
  • Primitive
  • Atomic
  • Generalized Atomic (XPath)
  • date/time

xs:anyAtomicType

Date

Sources: [1], [3], [4], [11], [14]

xs:dateTime

An instant in time.

  • Schema (XSD, XDM)
  • Primitive
  • Atomic
  • Generalized Atomic (XPath)
  • date/time

xs:anyAtomicType

xs:dateTimeStamp

DateTime

Sources: [1], [3], [4], [11], [14]

xs:dateTimeStamp

A generalized atomic type.

  • Schema (XSD, XDM)
  • Atomic
  • Ordinary
  • Generalized Atomic (XPath)
  • date/time

xs:dateTime

DateTime

Sources: [1], [4], [6], [11], [14]

xs:dayTimeDuration

A generalized atomic type.

  • Schema (XSD, XDM)
  • Atomic
  • Generalized Atomic (XPath)
  • Ordinary
  • date/time

xs:duration

Duration

Introduced in XDM 3.0.

Sources: [1], [4], [6], [11], [14]

xs:decimal

A real number that can be represented by decimal numerals.

  • Schema (XSD, XDM)
  • Primitive
  • Atomic
  • Generalized Atomic (XPath)

xs:anyAtomicType

xs:integer

Numeric

Sources: [1], [3], [4], [11], [14]

document-node()

A wrapper node that represents an XML document.

  • Item (XPath)

node()

Document

Sources: [22]

xs:double

A double-precision floating point number.

  • Schema (XSD, XDM)
  • Primitive
  • Atomic
  • Generalized Atomic (XPath)

xs:anyAtomicType

Numeric

Sources: [1], [3], [4], [11], [14]

xs:duration

A duration of time without fixed endpoints.

  • Schema (XSD, XDM)
  • Primitive
  • Atomic
  • Generalized Atomic (XPath)
  • date/time

xs:anyAtomicType

xs:dayTimeDuration, xs:yearMonthDuration

Duration

Sources: [1], [3], [4], [11], [14]

element()

An XML element.

  • Item (XPath)

node()

schema-element()

Element

Sources: [22]

empty-sequence()

 
  • Special (XPath)

sequence

 

Sources: [24]

xs:ENTITIES

A list of xs:ENTITY values.

  • Schema (XSD, XDM)
  • List
  • Ordinary

list

 

See Types adopted from XML Schema

Sources: [1], [5], [6], [11]

xs:ENTITY

An XML entity.

  • Schema (XSD)
  • Atomic
  • Generalized Atomic (XPath)
  • Ordinary

xs:NCName

String-like

Sources: [1], [4], [6], [12], [14]

enum()

A constraint on xs:string, restricting the set of valid values.

  • Item (XPath)
  • Generalized Atomic (XPath)

item()

N/A

Sources: [14], [19], [22]

xs:error

A union type. Also a generalized atomic type.

  • Schema (XDM)
  • Union
  • Generalized Atomic (XPath)

union

 

Not expected to have any instances. See Types adopted from XML Schema

Sources: [7], [11], [14]

xs:float

A floating point number.

  • Schema (XSD, XDM)
  • Primitive
  • Atomic
  • Generalized Atomic (XPath)

xs:anyAtomicType

Numeric

Sources: [1], [3], [4], [11], [14]

function()

A function.

  • Item (XPath)

item()

array(), map()

Function

For more information, see Function items.

From XPath 4.0, function items have an identity property, which can be used to test whether two variables refer to the same function item or not.

Sources: [22]

xs:gDay

A whole Gregorian day within an arbitrary month and year.

  • Schema (XSD, XDM)
  • Primitive
  • Atomic
  • Generalized Atomic (XPath)
  • date/time

xs:anyAtomicType

gDay

Sources: [1], [3], [4], [11], [14]

xs:gMonth

A whole Gregorian month within an arbitrary year.

  • Schema (XSD, XDM)
  • Primitive
  • Atomic
  • Generalized Atomic (XPath)
  • date/time

xs:anyAtomicType

gMonth

Sources: [1], [3], [4], [11], [14]

xs:gMonthDay

A whole day within a specific Gregorian month in an arbitrary year.

  • Schema (XSD, XDM)
  • Primitive
  • Atomic
  • Generalized Atomic (XPath)
  • date/time

xs:anyAtomicType

gMonthDay

Sources: [1], [3], [4], [11], [14]

gnode()

A generalized node. It is always either an xnode() or a jnode().

  • Item (XPath)
  • Abstract (XPath)

item()

jnode(), node()

 

Introduced in XDM 4.0.

Sources: [13], [15], [22]

xs:gYear

A whole Gregoria year.

  • Schema (XSD, XDM)
  • Primitive
  • Atomic
  • Generalized Atomic (XPath)
  • date/time

xs:anyAtomicType

gYear

Sources: [1], [3], [4], [11], [14]

xs:gYearMonth

A whole Gregorian month in a specific Gregorian year.

  • Schema (XSD, XDM)
  • Primitive
  • Atomic
  • Generalized Atomic (XPath)
  • date/time

xs:anyAtomicType

gYearMonth

Sources: [1], [3], [4], [11], [14]

xs:hexBinary

Arbitrary hex-encoded binary data.

  • Schema (XSD, XDM)
  • Primitive
  • Atomic
  • Generalized Atomic (XPath)

xs:anyAtomicType

Binary

Sources: [1], [3], [4], [11], [14]

xs:ID

An XML identifier.

  • Schema (XSD)
  • Atomic
  • Generalized Atomic (XPath)
  • Ordinary

xs:NCName

String-like

Sources: [1], [4], [6], [8], [12], [14]

xs:IDREF

A cross-reference to an xs:ID.

  • Schema (XSD)
  • Atomic
  • Generalized Atomic (XPath)
  • Ordinary

xs:NCName

String-like

Sources: [1], [4], [6], [12], [14]

xs:IDREFS

A list of xs:IDREF values.

  • Schema (XSD, XDM)
  • List
  • Ordinary

list

 

See Types adopted from XML Schema

Sources: [1], [5], [6], [11]

xs:int

A generalized atomic type.

  • Schema (XSD)
  • Atomic
  • Generalized Atomic (XPath)
  • Ordinary

xs:long

xs:short

Numeric

Sources: [1], [4], [6], [14]

xs:integer

A generalized atomic type.

  • Schema (XSD)
  • Atomic
  • Generalized Atomic (XPath)
  • Ordinary

xs:decimal

xs:long, xs:nonNegativeInteger, xs:nonPositiveInteger

Numeric

Sources: [1], [4], [6], [14]

item()

An item is either an atomic item, a GNode, or a function item.

  • Item (XPath)

sequence

function(), gnode(), enum()

 

Sources: [16], [22]

jnode()

An encapsulation of a value as it appears within a tree of maps and arrays, typically (but not necessarily) obtained by parsing JSON texts.

  • Item (XPath)

gnode()

JNode

Introduced in XDM 4.0.

Sources: [17], [22]

xs:language

A formal natural language identifier.

  • Schema (XSD)
  • Atomic
  • Generalized Atomic (XPath)
  • Ordinary

xs:token

String-like

Sources: [1], [4], [6], [9], [12], [14]

list

 
  • Abstract (XSD)

xs:anySimpleType

xs:ENTITIES, xs:IDREFS, xs:NMTOKENS

 

Sources: [2], [5]

xs:long

A generalized atomic type.

  • Schema (XSD)
  • Atomic
  • Generalized Atomic (XPath)
  • Ordinary

xs:integer

xs:int

Numeric

Sources: [1], [4], [6], [14]

map()

A map.

  • Item (XPath)

function()

record()

Function

For more information, see Maps.

A record() may be used to constrain the type of items that may be added to a map.

Sources: [22]

xs:Name

An XML Name.

  • Schema (XSD)
  • Atomic
  • Generalized Atomic (XPath)
  • Ordinary

xs:token

xs:NCName

String-like

Sources: [1], [4], [6], [12], [14]

namespace-node()

An XML namespace node.

  • Item (XPath)

node()

Namespace

Sources: [22]

xs:NCName

An XML "non-colonized" xs:Name

  • Schema (XSD)
  • Atomic
  • Generalized Atomic (XPath)
  • Ordinary

xs:Name

xs:ID, xs:IDREF, xs:ENTITY

String-like

Sources: [1], [4], [6], [12], [14]

xs:negativeInteger

A generalized atomic type.

  • Schema (XSD)
  • Atomic
  • Generalized Atomic (XPath)
  • Ordinary

xs:nonPositiveInteger

Numeric

Sources: [1], [4], [6], [14]

xs:NMTOKEN

A single name token.

  • Schema (XSD)
  • Ordinary
  • Atomic
  • Generalized Atomic (XPath)

xs:token

String-like

Sources: [1], [4], [6], [12], [14]

xs:NMTOKENS

A list of xs:NMTOKEN values.

  • Schema (XSD, XDM)
  • Ordinary
  • List

list

 

Sources: [1], [5], [6], [11]

node()

An XML node.

Also known as: xnode()

  • Item (XPath)

gnode()

attribute(), comment(), document-node(), element(), namespace-node(), processing-instruction(), text()

XNode

While the concept of a node existed before 4.0, the term xnode() was introduced in 4.0 to differentiate between XML nodes and JSON nodes (see jnode()).

Sources: [18], [22]

xs:nonNegativeInteger

A generalized atomic type.

  • Schema (XSD)
  • Atomic
  • Generalized Atomic (XPath)
  • Ordinary

xs:integer

xs:positiveInteger

Numeric

Sources: [1], [4], [6], [14]

xs:nonPositiveInteger

A generalized atomic type.

  • Schema (XSD)
  • Atomic
  • Generalized Atomic (XPath)
  • Ordinary

xs:integer

xs:negativeInteger

Numeric

Sources: [1], [4], [6], [14]

xs:normalizedString

A string that doesn't contain the following characters: carriage return (#xD); line feed (#xA); line feed (#x9).

  • Schema (XSD)
  • Ordinary
  • Atomic
  • Generalized Atomic (XPath)

xs:string

xs:token

String-like

Sources: [1], [4], [6], [14]

xs:NOTATION

An XML notation attribute.

  • Schema (XSD, XDM)
  • Primitive
  • Atomic
  • Generalized Atomic (XPath)
  • Namespace-sensitive (XPath)
  • Abstract (XPath)

xs:anyAtomicType

Notation

Sources: [1], [3], [4], [11], [13], [14], [23]

xs:numeric

A union type whose members are: xs:double, xs:float and xs:decimal.

  • Schema (XDM)
  • Union
  • Generalized Atomic (XPath)

union

 

See Types adopted from XML Schema

Sources: [7], [11], [14]

xs:positiveInteger

A generalized atomic type.

  • Schema (XSD)
  • Atomic
  • Generalized Atomic (XPath)
  • Ordinary

xs:nonNegativeInteger

xs:unsignedLong

Numeric

Sources: [1], [4], [6], [14]

processing-instruction()

A processing instruction (PI).

  • Item (XPath)

node()

Processing-instruction

Sources: [22]

xs:QName

An XML qualified name.

  • Schema (XSD, XDM)
  • Primitive
  • Atomic
  • Generalized Atomic (XPath)
  • Namespace-sensitive (XPath)

xs:anyAtomicType

QName

Sources: [1], [3], [4], [11], [14], [23]

record()

May be used to constrain the type of items that may be added to a map.

  • Item (XPath)

map()

Function

Sources: [22]

schema-attribute()

A schema attribute.

  • Item (XPath)

attribute()

Schema Attribute

While the concept of a schema-attribute() existed before 4.0, XPath 4.0 classifies it as a sub-type of attribute().

Sources: [20], [22]

schema-element()

A schema element.

  • Item (XPath)

element()

Schema Element

While the concept of a schema-element() existed before 4.0, XPath 4.0 classifies it as a sub-type of element().

Sources: [21], [22]

sequence

One or more occurrences of an empty-sequence(), item() or non-abstract sub-type of xs:anyAtomicType.

  • Abstract (XPath)

xs:anyType

empty-sequence(), item()

 

Sources: [13]

xs:short

An xs:int between -32768 and 32767 (inclusive).

  • Schema (XSD)
  • Atomic
  • Generalized Atomic (XPath)
  • Ordinary
  • Numeric

xs:int

xs:byte

 

Sources: [1], [4], [6], [14]

xs:string

A string of characters.

  • Schema (XSD, XDM)
  • Primitive
  • Atomic
  • Generalized Atomic (XPath)

xs:anyAtomicType

xs:normalizedString

String-like

Sources: [1], [3], [4], [11], [14]

text()

Text in XML.

  • Item (XPath)

node()

Text

Sources: [22]

xs:time

An instant in time that recurs at the same point in each calendar day, or that occurs in some arbitrary calendar day.

  • Schema (XSD, XDM)
  • Primitive
  • Atomic
  • Generalized Atomic (XPath)

xs:anyAtomicType

Time

Sources: [1], [3], [4], [11], [14]

xs:token

An xs:normalizedString that has no leading or trailing spaces (#x20) and includes no internal sequences of two or more spaces.

  • Schema (XSD)
  • Ordinary
  • Atomic
  • Generalized Atomic (XPath)

xs:normalizedString

xs:NMTOKEN, xs:language, xs:Name

String-like

Sources: [1], [4], [6], [12], [14]

union

A generalized type.

  • Abstract (XSD)

xs:anySimpleType

xs:error, xs:numeric

N/A

Sources: [2]

xs:unsignedByte

Derived from xs:unsignedShort by setting the value of maxInclusive to 255.

  • Schema (XSD)
  • Atomic
  • Generalized Atomic (XPath)
  • Ordinary

xs:unsignedShort

Numeric

Sources: [1], [4], [6], [14]

xs:unsignedInt

Derived from xs:unsignedLong by setting the value of maxInclusive to 4294967295.

  • Schema (XSD)
  • Atomic
  • Generalized Atomic (XPath)
  • Ordinary

xs:unsignedLong

xs:unsignedShort

Numeric

Sources: [1], [4], [6], [14]

xs:unsignedLong

A generalized atomic type.

  • Schema (XSD)
  • Atomic
  • Generalized Atomic (XPath)
  • Ordinary

xs:positiveInteger

xs:unsignedInt

Numeric

Sources: [1], [4], [6], [14]

xs:unsignedShort

Derived from xs:unsignedInt by setting the value of maxInclusive to 65535.

  • Schema (XSD)
  • Atomic
  • Generalized Atomic (XPath)
  • Ordinary

xs:unsignedInt

xs:unsignedByte

Numeric

Sources: [1], [4], [6], [14]

xs:untypedAtomic

A primitive atomic type.

  • Schema (XSD, XDM)
  • Atomic
  • Generalized Atomic (XPath)
  • Ordinary

xs:anyAtomicType

String-like

Sources: [1], [4], [6], [11], [14]

xnode()

An alternative name for node().

Introduced in XDM 4.0.

This alternative name is only used in documentation. It's not expected to be used in code.

xs:yearMonthDuration

A generalized atomic type.

  • Schema (XSD, XDM)
  • Atomic
  • Generalized Atomic (XPath)
  • Ordinary
  • date/time

xs:duration

Duration

Introduced in XDM 3.0.

Sources: [1], [4], [6], [11], [14]

Sources

  1. https://www.w3.org/TR/xmlschema11-2/
  2. https://www.w3.org/TR/xmlschema11-2/#atomic-vs-list
  3. https://www.w3.org/TR/xmlschema11-2/#built-in-primitive-datatypes
  4. https://www.w3.org/TR/xmlschema11-2/#dt-atomic
  5. https://www.w3.org/TR/xmlschema11-2/#dt-list
  6. https://www.w3.org/TR/xmlschema11-2/#dt-ordinary
  7. https://www.w3.org/TR/xmlschema11-2/#dt-union
  8. https://www.w3.org/TR/xmlschema11-2/#ID
  9. https://www.w3.org/TR/xmlschema11-2/#language
  10. https://www.w3.org/TR/xmlschema11-2/#special-datatypes
  11. https://qt4cg.org/specifications/xpath-datamodel-40/Overview.html#xs-types
  12. https://www.w3.org/TR/xpath-datamodel-31/
  13. https://www.w3.org/TR/2017/REC-xpath-31-20170321/#id-cast
  14. https://qt4cg.org/specifications/xquery-40/xpath-40.html#dt-generalized-atomic-type
  15. https://qt4cg.org/specifications/xquery-40/xpath-40.html#dt-GNode
  16. https://qt4cg.org/specifications/xquery-40/xpath-40.html#dt-item
  17. https://qt4cg.org/specifications/xquery-40/xpath-40.html#dt-JNode
  18. https://qt4cg.org/specifications/xquery-40/xpath-40.html#dt-XNode
  19. https://qt4cg.org/specifications/xquery-40/xpath-40.html#id-enumeration-types
  20. https://qt4cg.org/specifications/xquery-40/xpath-40.html#id-item-subtype-attributes
  21. https://qt4cg.org/specifications/xquery-40/xpath-40.html#id-item-subtype-elements
  22. https://qt4cg.org/specifications/xquery-40/xpath-40.html#id-matching-item
  23. https://qt4cg.org/specifications/xquery-40/xpath-40.html#id-namespace-sensitive
  24. https://qt4cg.org/specifications/xquery-40/xpath-40.html#id-sequencetype-syntax