Hi all,
with the basex 10.7 version (but even in 9.6 version I have the same issue) I found that the following code wont work as expected:
(: It wont work :)
let $files := map {"hello1.txt" : xs:base64Binary('SGVsbG8gd29ybGQ='), "hello2.txt" : xs:base64Binary('SGVsbG8gd29ybGQ=')}
let $w := map:for-each($files, function($filename, $content) {
file:write-binary($filename, $content, 0)
})
return ()
that is, it will not write the two files hello1.txt and hello2.txt in the basex_home/bin folder.
But, if you return $w instead:
(: It works :)
let $files := map {"hello1.txt" : xs:base64Binary('SGVsbG8gd29ybGQ='), "hello2.txt" : xs:base64Binary('SGVsbG8gd29ybGQ=')}
let $w := map:for-each($files, function($filename, $content) {
file:write-binary($filename, $content, 0)
})
return $w
With a similar implementation, with the classic FLWOR, the issue does not arise, even if I return the empty sequence:
(: It works :)
let $files := map {"hello1.txt" : xs:base64Binary('SGVsbG8gd29ybGQ='), "hello2.txt" : xs:base64Binary('SGVsbG8gd29ybGQ=')}
let $w := for $filename in map:keys($files)
return file:write-binary($filename, map:get($files, $filename), 0)
return ()
that is it will write two files hello1.txt and hello2.txt in basex_home/bin folder.
Note that the files in the examples above are for demonstration purposes, however in my code they are actually binary files.
My java version is a Oracle JDK 17
This problem also occur to others?
Thanks,
Vincenzo