Difference between revisions of "XQuery Module"

From BaseX Documentation
Jump to navigation Jump to search
Line 16: Line 16:
 
| '''Summary'''
 
| '''Summary'''
 
|Evaluates {{Code|$expr}} as XQuery expression at runtime and returns the resulting items.<br />
 
|Evaluates {{Code|$expr}} as XQuery expression at runtime and returns the resulting items.<br />
 +
|-
 +
| '''Errors'''
 +
|{{Error|BXXQ0001|#Errors}} the query contains [[XQuery Update#Updating Expressions|updating expressions]].
 
|-
 
|-
 
| '''Examples'''
 
| '''Examples'''
Line 30: Line 33:
 
| '''Summary'''
 
| '''Summary'''
 
|Opens {{Code|$uri}} as file, evaluates it as XQuery expression at runtime, and returns the resulting items.<br />
 
|Opens {{Code|$uri}} as file, evaluates it as XQuery expression at runtime, and returns the resulting items.<br />
 +
|-
 +
| '''Errors'''
 +
|{{Error|BXXQ0001|#Errors}} the query contains [[XQuery Update#Updating Expressions|updating expressions]].
 
|}
 
|}
  
Line 41: Line 47:
 
| '''Summary'''
 
| '''Summary'''
 
|Similar to {{Code|fn:trace($expr, $msg)}}, but instead of a user-defined message, it emits the compile-time type and estimated result size of its argument.
 
|Similar to {{Code|fn:trace($expr, $msg)}}, but instead of a user-defined message, it emits the compile-time type and estimated result size of its argument.
 +
|}
 +
 +
=Errors=
 +
 +
{| class="wikitable" width="100%"
 +
! width="5%"|Code
 +
! width="95%"|Description
 +
|-
 +
|{{Code|BXXQ0001}}
 +
|A dynamically evaluated query must not contain any [[XQuery Update#Updating Expressions|updating expressions]].
 
|}
 
|}
  

Revision as of 19:56, 15 June 2012

This XQuery Module contains functions to evaluate XQuery strings and modules at runtime.

Conventions

All functions in this module are assigned to the http://basex.org/modules/xquery namespace, which is statically bound to the xquery prefix.
All errors are assigned to the http://basex.org/errors namespace, which is statically bound to the bxerr prefix.

Functions

xquery:eval

Signatures xquery:eval($expr as xs:string) as item()*
Summary Evaluates $expr as XQuery expression at runtime and returns the resulting items.
Errors BXXQ0001: the query contains updating expressions.
Examples
  • xquery:eval("1+3") returns 4.

xquery:invoke

Signatures xquery:invoke($uri as xs:string) as item()*
Summary Opens $uri as file, evaluates it as XQuery expression at runtime, and returns the resulting items.
Errors BXXQ0001: the query contains updating expressions.

xquery:type

Added in Version 7.2.

Signatures xquery:type($expr as item()*) as item()*
Summary Similar to fn:trace($expr, $msg), but instead of a user-defined message, it emits the compile-time type and estimated result size of its argument.

Errors

Code Description
BXXQ0001 A dynamically evaluated query must not contain any updating expressions.

Changelog

This module was introduced with Version 7.3. Functions have been adopted from the obsolete Utility Module.