This book describes the core features of the XQuery 1.0 language and its associated built-in functions and data model. There are several peripheral standards that complement, but are not central to, the XQuery 1.0 language. These standards, which are in varying stages of completion, include Serialization, XQueryX, XQuery Updates, Full-Text search, and XQJ.
Serialization is the process of writing the results of a query out to XML syntax. (Implementations are not required to support serialization at all, but most do.) In your query, you construct (or select) a number of XML elements and attributes to include in the results. These results conform to the data model described in Chapter 2. However, the data model does not define the details of the XML syntax and format to be used. Certain syntactic differences may appear when working with different implementations, such as the encoding used, whether an XML declaration is included at the beginning of a document, or whether the results are indented.
Some of these syntactic differences can be controlled using serialization parameters, which are listed in Table 22-1. Some implementations will allow you to specify values for some of the serialization parameters; this is covered further in the section entitled "Specifying Serialization Parameters" in Chapter 23.
For more information on serialization, including a detailed description of the effect of each serialization parameter, see XSLT 2.0 and XQuery 1.0 Serialization at http://www.w3.org/TR/xslt-xquery-serialization.
Table 22-1. Serialization parameters
Parameter name |
Description |
---|---|
|
The type of output, namely |
|
|
|
An optional list of qualified element names; the default is a zero-item list. Add an element name to the list if you would like its contents to be enclosed in a CDATA section in the output. |
|
A public identifier to be included in a document type declaration. |
|
A system identifier to be included in a document type declaration. |
|
The encoding to be used for the results. The default is either |
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=EUC-JP" />. |
|
|
|
The media type (MIME type); default is implementation-defined. |
|
One of |
|
|
|
|
|
|
|
Default is an empty list. A list of character maps that can be used to perform character substitution on the results. |
|
Default is implementation-defined, generally |
Errors occasionally occur during serialization. They may be the result of conflicting serialization parameters or a query that returns results that cannot be serialized. For example:
doc("catalog.xml")//@dept
is a perfectly valid query, but it will return a sequence of attribute nodes. This cannot be serialized and will raise an error. Serialization errors all start with the letters SE and are listed in Appendix C.
3.135.196.103