[MarkLogic Dev General] Java XCC save query result to file

David Lee David.Lee at marklogic.com
Tue Mar 20 13:58:34 PDT 2012


How critical to your app is it that the result is "streamed" ?
Is it always XML or is it sometimes text or binary ?

The xmlsh MarkLogic extension "get" command can be used as an example of writing the result items to a Java stream.

The "writeResult" method implements the guts of this command

http://xmlsh.svn.sourceforge.net/viewvc/xmlsh/extensions/marklogic/src/org/xmlsh/marklogic/util/MLCommand.java?revision=671&view=markup

The key is that a ResultSequence is an iterator of XdmItem.
Each XdmItem has a "writeTo" method.

There is no guarentee that this is "streamed" to my knowledge but it may well be.






-----------------------------------------------------------------------------
David Lee
Lead Engineer
MarkLogic Corporation
dlee at marklogic.com
Phone: +1 650-287-2531
Cell:  +1 812-630-7622
www.marklogic.com<http://www.marklogic.com/>

This e-mail and any accompanying attachments are confidential. The information is intended solely for the use of the individual to whom it is addressed. Any review, disclosure, copying, distribution, or use of this e-mail communication by others is strictly prohibited. If you are not the intended recipient, please notify us immediately by returning this message to the sender and delete all copies. Thank you for your cooperation.

From: general-bounces at developer.marklogic.com [mailto:general-bounces at developer.marklogic.com] On Behalf Of Gary Larsen
Sent: Tuesday, March 20, 2012 4:38 PM
To: 'General MarkLogic Developer Discussion'
Subject: [MarkLogic Dev General] Java XCC save query result to file

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20120320/e15b5fa8/attachment.html 


More information about the General mailing list