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

Reply via email to