# XQuery changes

Namespace undeclarations (`declare namespace p = ""`) are now accepted in the Query prolog.

URILiterals appearing in a query (for example, namespace URIs, collation URIs, module locations, schema locations, the base URI) now recognize ampersand-escaping of special characters. In particular, an ampersand used within a URI must be written as `&amp;`.

A collation URI appearing either in an `order by` clause or in the `default collation` declaration is now required to be a valid URI, and if it is relative, it is resolved relative to the base URI from the static context before being passed to the `CollationURIResolver`.

Comments may now be empty, that is, `(::)` is allowed. This also affects XPath.

The contents of a pragma are now validated: the pragma must start with a valid QName. If the QName is in the Saxon namespace, then the local-name must represent a recognized pragma.

A new pragma extension is available in Saxon-SA: the construct `(# saxon:validate-type type-name #){ expr }` causes the result of the expression `expr` to be validated against a named global type. This follows the same rules as the `type="type-name"` attribute in XSLT. Validating against a global type has been found to be useful when using schemas such as FpML, which make extensive use of `xsi:type`, and feature local element declarations with global types.

To make it easier to embed XQuery in other environments, a new method `setExternalNamespaceResolver` is provided on the `StaticQueryContext` object.

The -v option, which invokes DTD validation, has been added to the Query command line.

Next