Hi James,
try { db:replace(“DATABASE_NAME”,”PATH/TO/FILE”,<Element/>) } catch * { db:output(<insert code here>) }
Unfortunately, due to the semantics of XQuery Update, there is no chance to make this work, because all updating functions will first be moved to the pending update list [1] and processed after the query itself has been evaluated.
Instead, you should probably try to avoid having any other BaseX instances creating or accessing databases at the same time. If this can be ensured, BXDB0007 should never be raised.
Instead I always get a bxerr:BXDB0007 error thrown and I can’t find any way to catch it. (It’s also not listed as a possible error in the documentation, although is against db:create)
It's listed in the documentation of db:create [2]; maybe you tried to find it in the general error code list?
Hope this helps, Christian
[1] http://docs.basex.org/wiki/XQuery_Update#Pending_Update_List [2] http://docs.basex.org/wiki/Database_Module#db:create