[MarkLogic Dev General] How to pass parameter ?

Michael Blakeley michael.blakeley at marklogic.com
Tue May 20 10:17:14 PDT 2008


Take a closer look at the XCC distribution: it is packed with 
documentation and code examples. Here's one from the docs section 
"Passing Variables With Queries", also available at 
http://developer.marklogic.com/pubs/3.2/javadoc/index.html

Session session = contentSource.newSession("mydatabase");
Request request = session.newAdhocQuery(
     "define variable $myvar as xs:string external\n" +
     "data($myvar)");

// create Variable "myvar", bind to Request, ignore return value
request.setNewVariable("myvar", ValueType.XS_STRING,
   "Some string value");

// "$myvar as xs:string" will be defined at query run time
ResultSequence rs = session.submitRequest(request);

You could use the same technique with a module invoke or spawn.

-- Mike

Parthiban.K wrote:
> Hi,
> 
> How to pass parameter to in-built xQuery method from java using XCC API ?
> 
> 
> Thanks in advance.
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general



More information about the General mailing list