A simple example of a processing model for XQuery is shown in Figure 2-1. This section describes the various components of this model.
Figure 2-1. A Basic XQuery processor
Throughout this book, the term input document is used to refer to the XML data that is being queried. The data that is being queried can, in fact, take a number of different forms, for example:
Text files that are XML documents
Fragments of XML documents that are retrieved from the Web using a URI
A collection of XML documents that are associated with a particular URI
Data stored in native XML databases
Data stored in relational databases that have an XML frontend
In-memory XML documents
use a hardcoded link to the location of the input document(s), using the
collection function in the query. Other queries operate on a set of input data that is set by the processor at the time the query is evaluated.
Whether it is physically stored as an XML document or not, an input document must conform to other constraints on XML documents. For example, an element may not have two attributes with the same name, and element and attribute names may not contain special characters other than dashes, underscores, and periods.
An XQuery query could be contained in a text file, embedded in program code or in a query library, generated dynamically by program code, or input by ...