Great suggestion ! I hadn't thought of that.
Passing an external parameter with the body of the doc to document-insert ....


-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Michael Blakeley
Sent: Wednesday, May 20, 2009 2:21 PM
To: General Mark Logic Developer Discussion
Subject: Re: [MarkLogic Dev General]session.insertContent vsxdmp:document-insert

That would be true for xdmp:document-load(), but xdmp:document-insert() 
does not rely on the filesystem. An XCC program could pass XML as an 
external variable of type xs:string to an XQuery module, which would 
unquote it, then doc-insert the result. For an example of this 
technique, see 
http://developer.marklogic.com/svn/recordloader/trunk/README.html (under 
"CONTENT_FACTORY_CLASSNAME").

But as Danny points out, XCC's built-in Content class is likely to be 
more efficient for most applications. One exception relates to Robert's 
other recent question: "Saving a document with properties". It's fairly 
simple to use xdmp:document-insert() and xdmp:document-add-properties() 
in a single transaction, while XCC's ContentCreateOptions API does not 
support document properties.

-- Mike

On 2009-05-20 10:38, Lee, David wrote:
> The other issue is “where is the source content”.
> If the ML server is on a machine which does not have local file access to the 
> source content, then the ONLY way to get it there is with 
> session.insertContent()
> which reads from the client machine.
>
>
>
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Danny Sokolsky
> Sent: Wednesday, May 20, 2009 1:37 PM
> To: General Mark Logic Developer Discussion
> Subject: RE: [MarkLogic Dev General] session.insertContent 
> vsxdmp:document-insert
>
> Hi Robert,
>
> I am not a much of a Java guy, so others might be better to comment on this 
> one, but I think the difference is that with session.insertContent, you are 
> using Java to stream in the content to MarkLogic Server.  With 
> xdmp:document-insert, you are using XQuery to create the content in memory to 
> insert.  If you have a large amount of content on the client machine (where 
> the XCC program is running) to load, then it makes sense to use 
> insertContent.  I believe this is what the open source project RecordLoader 
> does (http://developer.marklogic.com/code/#recordloader).
>
> -Danny
>
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Runstein, 
> Robert E. (Contr) (IS)
> Sent: Wednesday, May 20, 2009 8:01 AM
> To: [email protected]
> Subject: [MarkLogic Dev General] session.insertContent vs xdmp:document-insert
>
>
> What is the difference between session.insertContent and 
> xdmp:document-insert?  When using xcc is there any advantage to using one 
> over the other?  Thanks.
>
> Bob
>


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

Reply via email to