On Fri, Feb 11, 2022 at 08:12:22PM +0000, Hans-Juergen Rennau scripsit:
Well, Liam, as I said - it can be done, my request is for supporting elegance. Here's the litmus test. How would you rewrite this little function ...
declare function f:docs($dir, $fname, $deep) as document-node()* { file:list($dir, true(), $fname) ! concat(file:resolve-path($dir), '/', .) ! (try {doc(.)} catch * {}) };
It's entirely likely I'm missing something here, but isn't the intent of this pretty much
db:create("DB", file:list($dir, true(), $fname), ())
where that third param to db:create lets you remap the path if required?
At which point the use case becomes db:open('DB')/*/@version => distinct-values() => sort()
In general, I don't want to have to think about files; it's great that the file module is there for those occasions where this cannot be avoided, but in general I want the XML loaded into a database (where someone with much better test cases has written the functions!) much more than I want to think about file system details.
What am I missing?