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