2

How can I read a non-XML (specifically CSV) file that is stored in a BaseX database from a query? csv:doc() expects a URI, how do I point it to a file inside the database?

1 Answers1

1

Ooh, I think I got it:

csv:parse(convert:binary-to-string(db:retrieve("db", "path/to/file.csv"), 'UTF-8')

Or is there an easier way?

  • 1
    You are right, that’s currently the only way. `db:retrieve` could possibly be replaced with something like `db:raw-text` and `db:raw-binary`; we thought about that in the past. Thanks for the observation. – Christian Grün May 24 '21 at 11:25