(: Load all documents with .xml extension from data directory under modules-root to Marklogic database :)
for $document in xdmp:filesystem-directory(fn:concat(xdmp:modules-root(), "data"))/node()/dir:pathname[matches(., '\.xml$')]
return
xdmp:document-load (
$document,
{fn:concat("", fn:tokenize($document/text(), "/")[last()])}
none
{xdmp:default-permissions()}
xml
)
for $document in xdmp:filesystem-directory(fn:concat(xdmp:modules-root(), "data"))/node()/dir:pathname[matches(., '\.xml$')]
return
xdmp:document-load (
$document,
)