Changes

Jump to navigation Jump to search
374 bytes added ,  14:18, 29 January 2019
==Elvis Operator==
The Elvis operator is also available in other languages. It is sometimes called [https://en.wikipedia.org/wiki/Null_coalescing_operator null-coalescing operator]. In XQuery, the value of the first operand will be returned if it is a non-empty sequence. Otherwise, the value of the second operand will be returned. It is equivalent to the {{Function|Utility|util:or}} function:
<pre class="brush:xquery">
(: if/then/else :)
if (exists($number)) then $number else 0,
(: function call :)
util:or($number, 0),
(: elvis operator :)
$number ?: 0
)
</pre>
 
The behavior of the operator is equivalent to the {{Function|Utility|util:or}} function.
==If Without Else==
)
</pre>
 
The behavior of the if expression is equivalent to the {{Function|Utility|util:if}} function.
=Functions=
=Serialization=
* <code>basex</code> is used as the default serialization method: nodes are serialized as XML, atomic values are serialized as string, and items of binary type are output in their native byte representation. Function items (including maps and arrays) are output just like with the [[XQuery 3.1#Adaptive Serialization|adaptive]] method.* With {{Code|csv}} allows , you to can output XML nodes as CSV data (see the [[CSV Module]] for more details).* With {{Code|json}}, items are output as JSON as described in the [https://www.w3.org/TR/xslt-xquery-serialization-31/#json-output official specification]. If the root node is of type {{Code|element(json)}}, items are serialized as described for the {{Code|direct}} format in the [[JSON Module]].
For more information and some additional BaseX-specific parameters, see the article on [[Serialization]].
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu