The example produces an error saying it can’t convert string to document node:
declare
%rest:path("/store.csv")
%rest:POST("{$csv}")
%input:csv("header=true,encoding=CP1252")
function page:store-csv($csv as document-node()) {
"Number of rows: " || count($csv/csv/record)
};
I can just change the function signature and parse the string with csv:parse, but is the example missing a detail (or am I missing a detail)?
I used this to store CSV data in the default format.
curl –XPOST –H’Content-Type: text/csv’ –data @some.csv
http://example.com/basex/store.csv
Kendall