[MarkLogic Dev General] absolute path: xdmp:document-get vs xdmp:uri-is-file

Eric Palmitesta eric.palmitesta at utoronto.ca
Wed Dec 17 12:44:23 PST 2008


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


More information about the General mailing list