You'll need to create a wrapper function that converts the string passed in by the XCC call to a node.
Here's a two MarkMail threads discussing similar issues: http://markmail.org/message/xhan3oux27xiwxys http://markmail.org/message/n3k3nl7zzo2ennlg Hope this helps! -fs From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ashish Kumar Sent: Tuesday, June 24, 2008 6:02 AM To: [email protected] Subject: [MarkLogic Dev General] How to convert a String to element type Hi I am evaluating MarkLogic server for our new project. I was trying to use lib-search library for searching. Following function accepts element. define function search-results($search-criteria as element(search:search-criteria), $start as xs:integer, $end as xs:integer) as node()* { get-search-results(build-search-string($search-criteria, build-cts-query($search-criteria)), $start, $end) } We can invoke the same by import module namespace search="http://www.marklogic.com/ps/lib/lib-search" at "lib-search.xqy" import module namespace search1="http://www.marklogic.com/ps/lib/lib-search" at "lib-search-custom.xqy" search:search-results(<search:search-criteria><search:term><search:text>smit h</search:text></search:term></search:search-criteria> , 1, 5) Same I was trying to invoke through java xcc library. But I get the following exception Exception in thread "main" com.marklogic.xcc.exceptions.XQueryException: XDMP-AS: search1:search-results("<search:search-criteria> <search:term><search:text>cell</search:...", 1, 5) -- Invalid coercion: "<search:search-criteria> <search:term><search:text>cell</search:..." as element(search:search-criteria) in /libSearch-SearchSummary1.xqy, on line 5 expr: search1:search-results("<search:search-criteria> <search:term><search:text>cell</search:...", 1, 5) at com.marklogic.xcc.impl.handlers.ServerExceptionHandler.handleResponse(Server ExceptionHandler.java:31) at com.marklogic.xcc.impl.handlers.EvalRequestController.serverDialog(EvalReque stController.java:68) at com.marklogic.xcc.impl.handlers.AbstractRequestController.runRequest(Abstrac tRequestController.java:72) at com.marklogic.xcc.impl.SessionImpl.submitRequest(SessionImpl.java:280) at com.marklogic.xcc.examples.ModuleRunner.invoke(ModuleRunner.java:117) at com.marklogic.xcc.examples.ModuleRunner.invokeToSingleString(ModuleRunner.ja va:131) at com.marklogic.xcc.examples.ModuleRunner.main(ModuleRunner.java:176) Pointers to the above will be appreciated. Thanx a ton in advance, /Ashish
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
