Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8840563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:29:31+00:00 2026-06-14T10:29:31+00:00

We have a fairly simple XQuery and Groovy code as follows. Xquery code :

  • 0

We have a fairly simple XQuery and Groovy code as follows.
Xquery code :

declare variable $criteria as element(criteria) external ;

<scopedInterventions>{
$criteria/equals/field
}</scopedInterventions>

Here is the test code that is trying to invoke it

def uri = new URI("xcc://admin:admin@localhost:8001")

def contentSource = ContentSourceFactory.newContentSource(uri)

def request = session.newModuleInvoke("ourQuery.xqy")
def criteria =
"""<criteria>
<equals>
<field>status</field>
<value>draft</value>
</equals>
</criteria>
"""

request.setNewVariable("criteria",ValueType.ELEMENT, criteria);

session.submitRequest(request).asString()
}

We are getting this error when executing:

Caused by: com.marklogic.xcc.exceptions.XQueryException: XDMP-LEXVAL:
xs:QName(“element()”) — Invalid lexical value “element()” [Session:
user=admin, cb={default} [ContentSource: user=admin, cb={none}
[provider: address=localhost/127.0.0.1:9001, pool=1/64]]] [Client:
XCC/5.0-3, Server: XDBC/5.0-3] expr: xs:QName(“element()”) at
com.marklogic.xcc.impl.handlers.ServerExceptionHandler.handleResponse(ServerExceptionHandler.java:34)
at
com.marklogic.xcc.impl.handlers.EvalRequestController.serverDialog(EvalRequestController.java:83)
at
com.marklogic.xcc.impl.handlers.AbstractRequestController.runRequest(AbstractRequestController.java:84)
at
com.marklogic.xcc.impl.SessionImpl.submitRequestInternal(SessionImpl.java:373)
at
com.marklogic.xcc.impl.SessionImpl.submitRequest(SessionImpl.java:356)
at
com.zynx.galen.dataaccess.MarkLogicUtilities.executeQueryWithMultipleXMLParameters(MarkLogicUtilities.groovy:52)
at
com.zynx.galen.repositories.ScopedInterventionService.getScopedInterventionsByCriteria(ScopedInterventionService.groovy:20)
… 1 more

Any help would be greately appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:29:32+00:00Added an answer on June 14, 2026 at 10:29 am

    http://docs.marklogic.com/javadoc/xcc/overview-summary.html has the answer, I think:

    Passing Variables With Queries

    Variables may be bound to Request objects. When an execution request
    is issued to the server with Session.submitRequest(Request) all the
    variables currently bound to the Request object are sent along and
    defined as external variables in the execution context in the server.

    XCC lets you create XdmNodes and XdmSequences, as well as XdmAtomic
    values. However, in the initial XCC release values of this type may
    not be bound as external variables because MarkLogic Server cannot yet
    accept them. This capability is anticipated for a future release.

    Since XdmNode is not supported, I suppose its subclass XdmElement is not supported either. So these classes are only useful for responses, not requests. The error message could stand to be improved.

    You could pass the XML string using setNewStringVariable, then call xdmp:unquote in your XQuery module. Note that xdmp:unquote returns a document-node, so the /* XPath step yields its root element.

    declare variable $xml-string as xs:string external ;
    declare variable $criteria as element(criteria) := xdmp:unquote($xml-string)/* ;
    ....
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a fairly simple block of code. Sub Run(Name) on error resume next
I have a fairly simple Linq query (simplified code): dim x = From Product
I have a fairly simple spreadsheet application with some VBA code that performs simple
I have a fairly simple piece of code: Private _PurchaseDelivery as PurchaseDelivery Protected Overrides
I have some fairly simple code here, but I can't for the life of
I have a fairly simple const struct in some C code that simply holds
I have a fairly simple piece of code that retrieves an object from the
I have a fairly simple web2py form with a few validators like, IS_FLOAT_IN_RANGE(...) on
I have a fairly simple question, however the answer seems to elude me. If
I have a fairly simple query: SELECT invoice_id WHERE employee_id = 'XXXX' AND customer_id

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.