Thanks Geert and Danny, that's great! I'll use the solution suggested by both of you.
BTW, is there a channel to submit typos and other small problems doc-wise? wouldn't want to abuse this list (not that I've noticed many! :)). Jakob. On Fri, Aug 7, 2009 at 18:12, Danny Sokolsky<[email protected]> wrote: > Thanks Jakob, we'll make sure the doc for xdmp:directory-create gets fixed. > > As for checking if the directory exists, a directory is a properties fragment > at a URI with the special prop:directory property (see the "Properties > Documents and Directories" chanper of the Application Developer's Guide, chap > 10 p 102-- http://developer.marklogic.com/pubs/4.1/books/dev_guide.pdf). > > For example, if you run the following: > > xdmp:directory-create("/test/jakob/") > > then run the following: > > xdmp:document-properties("/test/jakob/") > > it returns the following properties document: > > <prop:properties xmlns:prop="http://marklogic.com/xdmp/property"> > <prop:directory/> > </prop:properties> > > So to check for its existence, check to see if the xdmp:document-properties > call on the directory URI has a prop:directory property. > > Hope that helps. > > -Danny > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Jakob Fix > Sent: Friday, August 07, 2009 7:16 AM > To: General Mark Logic Developer Discussion > Subject: [MarkLogic Dev General] discrepancy between doc and release notes > (directory-create) > > Just a quick note that the doc seems out of sync with reality :) > > doc for xdmp:directory-create() > http://developer.marklogic.com/pubs/4.1/apidocs/UpdateBuiltins.html#xdmp:directory-create > > "Creates a directory. If security is enabled, the document permissions > and collections are set to the given parameters, if supplied. > Otherwise, the current user's default permissions and/or collections > are applied. If the beginning of the the document URI is protected, > the user must have access to that URI privilege. If the directory URI > does not end with a '/' one is added. *If the directory already > exists, then nothing is done*." > > release notes: > http://developer.marklogic.com/pubs/4.1/books/relnotes.pdf > > "In 4.1, if you try to create a directory (using > xdmp:directory-create, for example) and the > directory already exists, then an exception is thrown > (XDMP-DIREXISTS). In 4.0, the directory was > re-created, and no exception was thrown. If you have code that relies > on the old behavior, you > must modify that code to make it handle the exception when the > directory exists." > > As there doesn't seem to be a xdmp:directory-exists() function (could > fn:exists() be used?), what's the "correct" way to avoid exceptions > been thrown? I'm currently using try/catch. > > cheers, > Jakob. > _______________________________________________ > 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
