You can add documents to the database without first writing them to the file system[1]:
Thanks for such information.
This needs to be done in an updating function or …
I am looking for further advices also according to XQuery script variants like the following.
declare %updating function local:add_document($items as item()*) as empty-sequence() { let $result := db:add("Test_DB", $items, "Test.xml") return () };
let $my_data as element() := <root><contents>My document</contents></root>, $result := local:add_document($my_data) return ()
Test result: [XUST0001] let: no updating expression allowed.
let $my_data as element() := <root><contents>My document</contents></root>, $add_document := %updating function($items) {db:add("Test_DB", $items, "Test.xml")} return ($add_document($my_data))
Test result: [XPTY0004] Function is updating: $add_document.
https://docs.basex.org/wiki/XQuery_Update#User-Defined_Functions
How should the affected components be adjusted further according to the development software “BaseX 9.7.2”?
Regards, Markus