Loading TOC...

MarkLogic 9 Product Documentation
xdmp:eval-in

xdmp:eval-in(
   $xquery as xs:string,
   $ID as xs:unsignedLong*,
   [$vars as item()*],
   [$modules as xs:unsignedLong?],
   [$root as xs:string?]
) as item()*

Summary

[DEPRECATED: use xdmp:eval with the database option instead] Returns the result of evaluating a string as an XQuery module in a given database.

Parameters
xquery The XQuery string to be evaluated. If the XQuery string contains double quotes ("), surround the string with single quotes (').
ID The database ID, from xdmp:database("db_name"), xdmp:security-database(), or xdmp:schema-database().
vars The external variable values for this evaluation. This must be a sequence of even length, alternating QNames and items. Each QName and item pair specify a variable name and value.
modules The modules database for processing module imports. The empty sequence specifies the current modules database.
root The root path for modules. The empty sequence specifies the current root.

Example

  xdmp:eval-in("1+1",2348790529)
  => 2

Example

xquery version "0.9-ml"
declare namespace my='http://mycompany.com/test'

let $s :=
      "xquery version '0.9-ml'
       declare namespace my='http://mycompany.com/test'
       define variable $my:x as xs:string external
       concat('hello ', $my:x)"
return
    (: evaluate the query string $s using the variables
       supplied as the second parameter to xdmp:eval :)
    xdmp:eval-in($s,
                 xdmp:database("Documents"),
		 (xs:QName("my:x"),
		 "world"))

=> hello world
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.