# Using XQuery

This section describes how to use Saxon as an XQuery processor, either from the command line, or from the Java API.

For details of the .NET API, see Saxon API for .NET

The run-time code in Saxon that supports XQuery and XSLT is identical, reflecting the fact that they have very similar semantics. Most of the compile-time code (in particular, the type checking logic and the optimizer) is also common. The XQuery support in Saxon consists essentially of an XQuery parser (which is itself an extension of the XPath parser); the parser generates the same internal interpretable code as the XSLT processor.

The XQuery processor may be invoked either from the operating system command line, or via an API from a user-written application. There is no graphical user interface provided.

Saxon is an in-memory processor. Whether you use XSLT or XQuery, Saxon is designed to process source documents that fit in memory. Saxon has been used successfully to process source documents of 100Mbytes or more, but if you attempt anything this large, you need to be aware (a) that you will need to allocate sufficient memory to the Java VM (at least 5 times the size of the source document), and (b) that complex FLWOR expressions may be very time-consuming to execute (In this scenario, Saxon-SA is recommended, because it has a more powerful optimizer for complex joins).

For details of how to set up collation URIs for use in XQuery, see Implementing a Collating Sequence

Next