Hi Ron,

I will try the caching options.  What had me confused was getting to the
XdmItem. Wasn't aware of asString() either.

Thanks for the help

Gary 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Ron Hitchens
Sent: Tuesday, March 20, 2012 5:06 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Java XCC save query result to file


   Simple.  Call asString() on the ResultSequence object
and write the String to a file.  Or asStrings() if you
want a separate String for each item in the sequence to
send to different files.

   Or, if the result is truly streaming (see the setCacheResult())
method of the RequestOptions class, streaming is not the default),
you can use the writeTo() methods on the ResultItem(s) in the
ResultSequence.  These take an open Writer or OutputStream and
copy the data across.  They work if you're not streaming, as well.

   There is an example in the XCC JavaDocs that might be helpful.
Go to http://community.marklogic.com/pubs/5.0/javadoc/index.html,
click the com.marklogic.xcc.examples package and then ContentFetcher
class (top one).  Look for the "Click here for the source code for
this class" link just above the Constructor Summary heading.

On Mar 20, 2012, at 8:37 PM, Gary Larsen wrote:

> Hi,
>  
> For some queries I'm using the xdmp:save() function to store results to
file.   This will not always work because the MarkLogic server may not have
access to the share location.
>  
> Instead the results will need to be saved by the application by streaming
the ResultSequence returned from session.submitRequest(request) call.
>  
> Is there a preferred way to do this?
>  
> Thanks for your advice.  An example would be helpful if you have one.
>  
> Gary
>  
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general

---
Ron Hitchens {mailto:[email protected]}   Ronsoft Technologies
     +44 7879 358 212 (voice)          http://www.ronsoft.com
     +1 707 924 3878 (fax)              Bit Twiddling At Its Finest
"No amount of belief establishes any fact." -Unknown




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

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

Reply via email to