Loading TOC...

xdmp.xqueryEval

xdmp.xqueryEval(
   $xquery as String,
   [$vars as Object],
   [$options as Object?]
) as Sequence

Summary

Returns the result of evaluating a string as an XQuery module. For details, see the XQuery function xdmp:eval.

Parameters
$xquery For details, see the XQuery function xdmp:eval.
$vars For details, see the XQuery function xdmp:eval.
$options The options are the same as those documented with xdmp.eval.

Example

xdmp.xqueryEval(" 'hello world, today is: ', fn:current-dateTime() ");
=>
hello world, today is: 
2015-01-21T14:24:50.453913-08:00

Comments

  • Here’s an example of serializing a query as XML from JavaScript. Note the <code>vars</code> parameter format. <pre><code> var q = cts.wordQuery('asdf'); xdmp.xqueryEval('declare variable $q as cts:query external; &lt;a>{$q}&lt;/a>/*', [xs.QName('q'), q]); </code></pre>
    • I believe that the above example is incorrect. The vars need to be passed in as a json object: var q = cts.wordQuery('asdf'); xdmp.xqueryEval('declare variable $q as cts:query external; <z>{$q}</z>/*', { "q" : q } );
Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy