[MarkLogic Dev General]
absolutepath: xdmp:document-getvs xdmp:uri-is-file
Danny Sokolsky
dsokolsky at marklogic.com
Wed Dec 17 16:20:01 PST 2008
If it is under the App Server root, you can always use http to get it
(xdmp:http-get, for example). Or xdmp:document-get. Or you can put it
in a "global" variable in an xquery module that you import (the import
can be relative).
But putting it in the database is probably the best idea.
-Danny
-----Original Message-----
From: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] On Behalf Of Eric
Palmitesta
Sent: Wednesday, December 17, 2008 2:19 PM
To: General Mark Logic Developer Discussion
Subject: Re: [MarkLogic Dev General] absolutepath: xdmp:document-getvs
xdmp:uri-is-file
Is there any way for an (.xqy) file to refer relatively to an (.xml)
file on the filesystem? Note that (.xqy) files need not be in a
subdirectory of the Marklogic installation.
My motivation here is a localization file (en.xml, fr.xml, etc)
containing keys and strings for i18n purposes. This file can easily be
inserted into the database, but editing then becomes tedious.
Eric
Danny Sokolsky wrote:
> I don't know of another way besides try/catch (which is great for this
> type of thing).
>
> -Danny
>
> -----Original Message-----
> From: general-bounces at developer.marklogic.com
> [mailto:general-bounces at developer.marklogic.com] On Behalf Of Eric
> Palmitesta
> Sent: Wednesday, December 17, 2008 12:44 PM
> To: General Mark Logic Developer Discussion
> Subject: Re: [MarkLogic Dev General] absolute path:
xdmp:document-getvs
> xdmp:uri-is-file
>
> Shorter version of my question: is there a file-system equivalent of
the
>
> fn:doc-available function?
>
> Eric
>
> Eric Palmitesta wrote:
>> Hi all,
>>
>> Hopefully I'm missing something and someone can put me on the right
> track.
>> It's fine to say "if (exists(doc('blah'))) then" because doc will
> simply
>> return () rather than producing an error. How do I do the same with
>> xdmp:document-get? Since xdmp:document-get errors with "file not
> found"
>> (if a file is indeed not found), I was hoping to check if the call
> will
>> fail before I make it. The xdmp:uri-is-file function looks like the
>> wrong one to use, though, because an absolute path means something
>> different:
>>
>> The api for xdmp:document-get says
>> "On the filesystem, the path can be fully qualifed or relative.
> Relative
>> pathnames are resolved from the directory in which MarkLogic Server
is
>
>> installed."
>>
>> The api for xdmp:uri-is-file says
>> says "If the URI begins with a '/', it is relative to the root
> directory
>> of the application server."
>>
>> Is a try/catch the only way?
>>
>> Thanks,
>>
>> Eric
>> _______________________________________________
>> General mailing list
>> General at developer.marklogic.com
>> http://xqzone.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
General at developer.marklogic.com
http://xqzone.com/mailman/listinfo/general
More information about the General
mailing list