My suggestion is that you pass the sequence as a delimited string and then 
split that into a sequence inside the module using fn:tokenize:

declare variable $collections-string as xs:string? external;
declare variable $collections as xs:string* := tokenize($collections-string, 
',')[. ne ''];

From: [email protected] 
[mailto:[email protected]] On Behalf Of Lee, David
Sent: Wednesday, May 26, 2010 8:09 AM
To: General Mark Logic Developer Discussion
Subject: Re: [MarkLogic Dev General] How to pass String Array to Marklogic 
usingXCC.Net API?

The short answer is "no".
You cant pass sequences, elements, documents or anything but atomic single 
value to XCC as external variables.
I consider this a major "bug" but it is what it is.

The long answer.
1) Wrap the sequence into a document, store the document in a temporary 
directory on the ML server,
then do an ad-hoc query to parse the document, generate the sequence and call 
your module.
Pseudo-code

Client:
                create doc  <doc><elem>a</elem><elem>b</elem> ....
                store doc in /temp/values.xml                  --- MAKE SURE 
THIS IS UNIQUELY NAMED (not always easy)
                call Ad-hoc query
                                let $seq := doc("/temp/values.xml")
                                return myprefix:myfun(  for $e in $seq//elem 
return $e/string()  )


2) Dynamically create an ad-hoc query in xquery with the sequence as part of 
the code

Client C# (ish)
                String query = "declare variable $args :-= (" ;
                for( value in values ...)
                                query = query + "\"" + value + "\"," ;
                query = query + "())"; // hack to avoid figuring out what the 
last item was ... I'm lazy

                query = query  + "myprefix:myfunc( $args) ";
                Call Ad-hoc query   $query



Feature Request to MarkLogic
PLEASE add support for sequences and nodes to XCC variables !!!!




From: [email protected] 
[mailto:[email protected]] On Behalf Of Pragya Kapoor
Sent: Wednesday, May 26, 2010 7:39 AM
To: [email protected]
Subject: [MarkLogic Dev General] How to pass String Array to Marklogic 
usingXCC.Net API?

Hi,

How to pass String Array to Marklogic using XCC.Net API.
Marklogic is expecting data in the form of string Array in a query, I want to 
pass the data in
A string array as {"a","b","c","d"} .
I am not able to find the way to pass it to ML using C#.

Is there any way to do it?

Thanks,
Pragya

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to