Product SiteDocumentation Site

5.7. Expressions dealing with types

This section describes JSONiq types as well as the sequence type syntax.

5.7.1. Instance-of expressions

InstanceofExpr
Figure 5.47. InstanceofExpr

An instance expression can be used to tell whether a JSONiq value matches a given sequence type.
Example 5.127. Instance of expression
1 instance of integer
Result (run with Zorba):
true

Example 5.128. Instance of expression
1 instance of string
Result (run with Zorba):
false

Example 5.129. Instance of expression
"foo" instance of string
Result (run with Zorba):
true

Example 5.130. Instance of expression
{ "foo" : "bar" } instance of object
Result (run with Zorba):
true

Example 5.131. Instance of expression
({ "foo" : "bar" }, { "bar" : "foo" }) instance of json-item+
Result (run with Zorba):
true

Example 5.132. Instance of expression
[ 1, 2, 3 ] instance of array?
Result (run with Zorba):
true

Example 5.133. Instance of expression
() instance of ()
Result (run with Zorba):
true