Thanks, Yitzhak,

We’ll have to update the documentation.
It’s probably best to use char('\t') instead of 'tab' in the future, or the ugly '	' alternative.

Hope this helps,
Christian


Von: Yitzhak Khabinsky via BaseX-Talk <basex-talk@mailman.uni-konstanz.de>
Gesendet: Freitag, 18. Juli 2025 14:06
An: basex-talk@mailman.uni-konstanz.de <basex-talk@mailman.uni-konstanz.de>
Betreff: [basex-talk] csv:doc(), csv:parse() functions are not respecting the 'field-delimiter': 'tab' parameter
 
Hello,

I am using BaseX 12.0

It seems that the csv:doc(), csv:parse() functions are not respecting the 'field-delimiter': 'tab' parameter.
It emits the following error:
[csv:parse] The value of 'field-delimiter' is not a single character: 'tab'.

Though the old style parameter is working:
'separator': 'tab'

It is documented here: https://docs.basex.org/main/CSV_Functions#options

Repro is below.

Failing XQuery
===============
declare variable $csv_file as xs:string external := 'c:\path\to\input.txt';
declare variable $xml_file as xs:string external := 'c:\path\to\output.xml';

let $input_options := { 'header': false(), 'trim-whitespace': true(), 'field-delimiter': 'tab' }
let $output_options := {'indent': 'yes', 'method': 'xml', 'encoding': 'UTF-8'}

return csv:doc($csv_file, $input_options) -> file:write($xml_file, ., $output_options)


Working XQuery
===============
declare variable $csv_file as xs:string external := 'c:\path\to\input.txt';
declare variable $xml_file as xs:string external := 'c:\path\to\output.xml';

let $input_options := { 'header': false(), 'trim-whitespace': true(), 'separator': 'tab' }
let $output_options := {'indent': 'yes', 'method': 'xml', 'encoding': 'UTF-8'}

return csv:doc($csv_file, $input_options) -> file:write($xml_file, ., $output_options)

Regards,
Yitzhak Khabinsky