• +49-(0)721-402485-12
Ihre Experten für XML, XQuery und XML-Datenbanken

Explicit type testing

As a further property of the for and let clauses, there is the possibility to perform a type testing via an explicit type declaration by means of the additional key word as. If the result type of the expression whose result the respective variable shall be bound to does not correspond with the explicitely indicated type, a runtime error is reported. As a consequence, the explicit type testing with the key word as within for and let clauses has the same effect as treat as. Therefore, the following example is not successfully executed, since the constant chracters strings do not correspond to the required type.

for $x as xs:integer in ("Lehner", "Schöning")
return
$x * 2

 

Source: "XQuery – Grundlagen und fortgeschrittene Methoden", dpunkt-Verlag, Heidelberg (2004)

<< backnext >>