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

Gary Larsen gary.larsen at envisn.com
Tue Mar 20 14:36:25 PDT 2012


Thanks David,

 

Just what I was looking for.  The data is always XML and can be very large
which was my interest in streaming as there is no needs for it to hang in
memory, but the Reader was probably what I was looking for.  

 

Gary Larsen

Envisn Inc.

978-779-0400 x202

508-259-6465 (cell)

 

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

 

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/x
mlsh/marklogic/util/MLCommand.java?revision=671
<http://xmlsh.svn.sourceforge.net/viewvc/xmlsh/extensions/marklogic/src/org/
xmlsh/marklogic/util/MLCommand.java?revision=671&view=markup> &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/5b640742/attachment.html 


More information about the General mailing list