[MarkLogic Dev General] xml file existence

Aaron Redalen Aaron.Redalen at marklogic.com
Thu Sep 4 08:32:21 PDT 2008


If you want to test in a conditional:

if (doc($uri))

If you actually want a boolean value:

exists(doc($uri))

Aaron
 

> -----Original Message-----
> From: general-bounces at developer.marklogic.com [mailto:general-
> bounces at developer.marklogic.com] On Behalf Of Eric Palmitesta
> Sent: Thursday, September 04, 2008 11:02 AM
> To: ML Developer Mailing List
> Subject: [MarkLogic Dev General] xml file existence
> 
> Hi all,
> 
> Is there a function to determine if an xml file exists within the ML
> database?  I thought it would be xdmp:uri-is-file, but as far as I can
> tell this checks for the existence of a file on the application server
> (not IN the database).  I can't find a native function to check this,
> currently I'm doing:
> 
> define function util:uri-exists($uri as xs:string)
> as xs:boolean
> {
> 	fn:exists(fn:doc($uri))
> }
> 
> Is there a better way?
> 
> Cheers,
> 
> Eric
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general


More information about the General mailing list