0
鑑於以下XQuery代碼生成路徑並基於MarkLogic數據庫中的數據保存文件,如何在不存在的情況下創建文件系統文件夾沒有得到例外?如何在保存文件時在文件系統上創建文件夾
for $doc in collection("http://example.com/stuff")
let $folderName := name($doc/Envelope/*[1])
let $folderPath := concat("c:\temp\", $folderName, "\")
let $fileName := concat($doc/Envelope/*[1]/*:Code/text(), ".xml")
let $fullPath := concat($folderPath, $fileName)
(: Create the folder at $folderPath if it does not exist :)
return xdmp:save($fullPath,$doc)