Chapter 6. XQuery for eXist

Most of your work using eXist will be done in the XQuery programming language. This chapter covers what is supported and what’s not. It will also describe some eXist XQuery specifics, like controlling the serialization and available pragmas.

eXist’s XQuery Implementation

Currently, 2.0+ versions of eXist support almost the full XQuery 1.0 specification (as eXist has done for years) and quite a lot of XQuery 3.0. This section will provide you with the details.

XQuery 1.0 Support

eXist implements almost the full XQuery 1.0 specification with the following exceptions:

  • eXist’s XQuery processor does not support the schema import and schema validation features, defined as optional in the XQuery specification (validate and import schema). The database does not store type information along with the (values of) nodes. It therefore cannot know the typed value of a node and has to assume xs:untypedAtomic. This is compliant with the behavior defined by the XQuery specification.

  • You cannot specify a data type in an element or attribute test. The node test element(test-node) is supported, but the test element(test-node, xs:integer) will result in a syntax error.

Note

These missing features do not mean that eXist is not type safe; it is, very much so. It only means that type checking based on schema imports is not implemented.

eXist tested its implementation against the official XQuery Test Suite (XQTS version 1.0.2). From the more than 14,000 tests, it passed over 99%.

Warning ...

Get eXist now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.