Hi Michael,
If I use a combination of an xdmp:http-get() and xdmp:document-insert(), isn't there a penalty for having to obtain the document before loading it or does xdmp:document-load() pretty much do the same thing as the combination of xdmp:http-get() and xdmp:document-insert() (any buffering included)? I suspect that calling xdmp:http-get() and xdmp:document-insert() from within an xquery module running in MarkLogic might take advantage of some optimizations in the MarkLogic database. Currently I have an .Net application with a .Net library that wraps xdmp:document-load in an HTTP Get invocation. I mapped the location of the source document to a virtual web address. Using this approach avoids buffering the source document locally before inserting it and prevents me from having to include and keep the XCC libraries current with the latest MarkLogic releases. It looks like there are a variety of methods available to accomplish my objective, but I would still like to submit a request to the new feature queue to obtain the http response status code xdmp:document-load(). Thank you! ~Tim -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Michael Blakeley Sent: Friday, May 14, 2010 11:23 AM To: General Mark Logic Developer Discussion Subject: Re: [MarkLogic Dev General] Is there a simple way to retrieve http response statuses wen invoking xdmp:document-load? Note that xdmp:http-get() supports repair options too - but they have to be specified in the right namespace. http://developer.marklogic.com/pubs/4.1/apidocs/Ext-2.html#xdmp:http-get > > This parameter can also include certain option elements (for example, > repair, encoding, default-language) in the xdmp:document-load and > xdmp:document-get namespaces. xdmp:http-get( 'http://google.com/DNE', <options xmlns="xdmp:http-get"> <format xmlns="xdmp:document-get">xml</format> <repair xmlns="xdmp:document-get">full</repair> </options>) You can also use xdmp:tidy() on the response. That technique can sometimes fix up html that is too far gone for repair=full to handle. You might even decide which options to use on a case-by-case basis. -- Mike On 2010-05-14 08:12, Mark Helmstetter wrote: > You could use xdmp:http-get() to fetch the document (which will give you an http status code), use xdmp:unquote() to convert to xml (you can specify repair options here), then call xdmp:document-insert(). > > From: [email protected] [mailto:[email protected]] On Behalf Of Tim Meagher > Sent: Friday, May 14, 2010 10:35 AM > To: 'General Mark Logic Developer Discussion' > Subject: [MarkLogic Dev General] Is there a simple way to retrieve http response statuses wen invoking xdmp:document-load? > > > xdmp:document-load() is a very powerful function for copying documents and is superior to xdmp:document-insert() because: > > > > 1. It allows for document repair, and > > 2. You can copy a document without having to buffer it and then insert it. > > > > However, as far as I can tell there is no simple way to determine the success of the document retrieval by checking the http response status code without looking at the contents of the inserted document. Is that right? Is there some kind of debug status that can be enabled for document loads to determine the success of the http response code? If not, may I suggest that a simple mechanism be made available for doing so? > > > > It would be nice to know if the http source server is working properly, whether it is up or overloaded or whether the user is just pinging the wrong document URI. > > > > Thank you! > > > > Tim Meagher > > > _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
