10 Adaptive Output Method

The Adaptive output method serializes the instance of the data model into a human readable form for the purposes of debugging query results. The intention of this is to allow any valid XDM instance to be serialized without raising a serialization error. Sequence normalization is not performed for this output method.

Each item in the supplied sequence is serialized individually as follows, with an occurrence of the chosen item-separator between successive items.

Character maps are applied (a) when nodes are serialized using the XML output method, and (b) to any value represented as a string enclosed in quotation marks.

Optionally, in all the above constructs, characters whose visual representation is ambiguous (for example tab or non-breaking-space) may be represented in the form of an XML numeric character reference (for example 	 or  )

Note:

In many cases the serialization of an item conforms to the syntax of an XQuery expression whose result is that item. There are exceptions, however: for example the syntax will not be valid XQuery in the case of free-standing attribute or namespace nodes, or QName values, or anonymous functions; and where it is valid XQuery, the result of evaluating the expression will not necessarily be identical to the original: for example, the distinction between strings and untypedAtomic values is lost.

If any value cannot be output because doing so would cause a serialization error, the behavior is implementation-defined.

If the output is sent to a destination that allows hyperlinks to be included in the generated text, then the serializer MAY include implementation-dependent hyperlinks to provide additional information for example:

10.1 The Influence of Serialization Parameters upon the Adaptive Output Method

For some item types the Adaptive output method will delegate serialization to other output methods. With the exception of the byte-order-mark serialization parameter, all serialization parameters, if set, will be passed down to the serialization method that is applied to each item in the supplied sequence. Only the item-separator and byte-order-mark parameters are directly applicable to the Adaptive output method.

10.1.1 Adaptive Output Method: the version Parameter

The version parameter is not directly applicable to the Adaptive output method.

10.1.2 Adaptive Output Method: the html-version Parameter

The html-version parameter is not directly applicable to the Adaptive output method.

10.1.3 Adaptive Output Method: the encoding Parameter

The encoding parameter is not directly applicable to the Adaptive output method.

10.1.4 Adaptive Output Method: the indent and suppress-indentation Parameters

The indent and suppress-indentation parameters are not directly applicable to the Adaptive output method.

10.1.5 Adaptive Output Method: the cdata-section-elements Parameter

The cdata-section-elements parameter is not directly applicable to the Adaptive output method.

10.1.6 Adaptive Output Method: the omit-xml-declaration and standalone Parameters

The omit-xml-declaration and standalone parameters are not directly applicable to the Adaptive output method.

Note:

If these parameters call for an XML declaration to be serialized, then an XML declaration is to be output each time the Adaptive output method delegates the serialization of a node to the XML output method. If several node items appear in the sequence to be serialized or as values in maps or arrays to be serialized, then the output will contain several XML declarations.

10.1.7 Adaptive Output Method: the doctype-system and doctype-public Parameters

The doctype-system and doctype-public parameters are not directly applicable to the Adaptive output method.

10.1.8 Adaptive Output Method: the undeclare-prefixes Parameter

The undeclare-prefixes parameter is not directly applicable to the Adaptive output method.

10.1.9 Adaptive Output Method: the normalization-form Parameter

The normalization-form parameter is not directly applicable to the Adaptive output method.

10.1.10 Adaptive Output Method: the media-type Parameter

The media-type parameter is not directly applicable to the Adaptive output method.

10.1.11 Adaptive Output Method: the use-character-maps Parameter

The use-character-maps parameter is directly applicable to the Adaptive output method only as elsewhere specified.

10.1.12 Adaptive Output Method: the byte-order-mark Parameter

The byte-order-mark parameter is applicable to the Adaptive output method. See 3 Serialization Parameters for more information.

Note:

A byte order mark can appear only once in the serialized output. Therefore, this parameter does not get passed down to any delegated output method.

10.1.13 Adaptive Output Method: the escape-uri-attributes Parameter

The escape-uri-attributes parameter is not directly applicable to the Adaptive output method.

10.1.14 Adaptive Output Method: the include-content-type Parameter

The include-content-type parameter is not directly applicable to the Adaptive output method.

10.1.15 Adaptive Output Method: the item-separator Parameter

The item-separator serialization parameter is directly applicable to the Adaptive output method. It specifies the string to be inserted between adjacent serialized items. If the item-separator parameter is absent, the string "
" (a single newline character) is used by the Adaptive output method as the item-separator value.

10.1.16 Adaptive Output Method: the allow-duplicate-names Parameter

The allow-duplicate-names parameter is not directly applicable to the Adaptive output method.

10.1.17 Adaptive Output Method: the json-node-output-method Parameter

The json-node-output-method parameter is not directly applicable to the Adaptive output method.