%input:csv annotation

Monday, 21 August 2017 · 1 message
KS
Kendall Shaw21 Aug 2017 06:01 #

Trying to use the example, in the RESTXQ section of the documentation:

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)
};

Using:

curl -i -XPOST –data @test.csv<mailto:data at test.csv> -H’Content-Type: text/csv’ http://blah/basex/store.csv

The result is [XPTY0004] Cannot cast xs:string to document-node()

I can just invoke csv:parse but, is the example missing a detail?

Kendall


⚡Generated with XQuery