Hi Kelly, Thank you for explaining this MarkLogic feature! But sadly it doesn't seem to solve the problem. I added *.dat extension to text/xml mimetypes list but still these files are concerned as binary and still fn:doc() does not work right for them. Could you (or anyone on this list) suppose what else am I doing wrong? Thanks in advance!
Van -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Kelly Stirman Sent: Tuesday, May 26, 2009 1:20 AM To: [email protected] Subject: [MarkLogic Dev General] RE: document-get() couldn't find the existing file Van, You're right - you cannot assign the output type when using fn:doc(). You need to set it correctly when you load the document, which you can do one of two ways: 1) go to the mimetype settings for your server and make .dat an xml document format. There are three options (text, xml, binary), and if the file format is not listed, the default is binary. I believe this is what occurred with your .dat file. 2) explicitly using xdmp:document-load() in the options node at the element <format/>. For more info on this, see section 10.2 of the developer guide: http://developer.marklogic.com/pubs/4.0/books/dev_guide.pdf I would also recommend reading section 10.1, which describes how the different document formats are treated for indexing. If you were having issues searching your .dat files, or issuing XPath expressions against them, it is because documents that are stored as binary are not indexed, and cannot be queried with XPath (even if they are *actually* XML). Hope this helps. Kelly Message: 2 Date: Mon, 25 May 2009 07:21:50 +0100 From: "Baranov, Ivan - Moscow" <[email protected]> Subject: RE: [MarkLogic Dev General] document-get() couldn't find the existing file To: General Mark Logic Developer Discussion <[email protected]> Message-ID: <[email protected]> Content-Type: text/plain; charset="us-ascii" Hi Danny Yes you're right but the problem is that fn:doc() does not allow to explicitly assign a document the XML format (at least I couldn't find any information on it). When I try to get, say, *.dat file from the database, its content is concerned as a binary() node even when it actually contains only XML tags. Is there any way to solve this? Van -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Danny Sokolsky Sent: Friday, May 22, 2009 8:40 PM To: General Mark Logic Developer Discussion Subject: RE: [MarkLogic Dev General] document-get() couldn't find the existing file Hi Ivan, xdmp:document-get gets a file over http or from a filesystem path. You are trying to get a document from the database. Use fn:doc for that. -Danny -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Baranov, Ivan - Moscow Sent: Thursday, May 21, 2009 11:39 PM To: [email protected] Subject: [MarkLogic Dev General] document-get() couldn't find the existing file Hello everyone, I've got troubles when using xdmp:document-get() fuction. Code like this define variable $get-options { <options xmlns="xdmp:document-get"> <format>xml</format> </options> } define function process-packet ( $update-packet as element() ) as element() { let $dir := $update-packet/@dir return if ($dir) then try { <update-results dir="{$dir}"> { let $destination := for $d in xdmp:directory(try-dir($dir), "infinity") return if(xdmp:uri-is-file(xdmp:node-uri($d))) then xdmp:document-get(xdmp:node-uri($d), $get-options) else () return xdmp:directory(try-dir($dir), "infinity") } </update-results> } catch($ex) { $ex } } returns nothing or (with xdmp:uri-is-file() check commented out) it throws an error: <err:error xsi:schemaLocation="http://marklogic.com/xdmp/error error.xsd"> <err:code>SVC-FILOPN</err:code> <err:message>File open error</err:message> <err:format-string> SVC-FILOPN: xdmp:document-get("/root/test-dir/target.xml", <options xmlns="xdmp:document-get"><format>xml</format></options>) -- File open error: open '/root/test-dir/target.xml ': No such file or directory </err:format-string> . . . The file is there, root path is correct. What is wrong? BTW can anyone tell me, is it true that xdmp:directory() takes only *.xml files as real XML content while all the other types are considered as binaries regardless to their content (even if it is node())? Seems like it is so. Thanks in advance, Van _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general_______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
