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
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to