Changes

Jump to navigation Jump to search
84 bytes removed ,  18:34, 1 December 2023
m
Text replacement - "</syntaxhighlight>" to "</pre>"
for $record at $pos in $csv?records
return $pos || ". " || string-join($record?*, ', ')
</syntaxhighlightpre>
The resulting representation consumes less memory than XML-based formats, and values can be directly accessed without conversion. Thus, it is recommendable for very large inputs and for efficient ad-hoc processing.
Name,First Name,Address,City
Huber,Sepp,Hauptstraße 13,93547 Hintertupfing
</syntaxhighlightpre>
'''Query:'''
let $text := file:read-text('addressbook.csv')
return csv:parse($text, map { 'header': true() })
</syntaxhighlightpre>
'''Result:'''
</record>
</csv>
</syntaxhighlightpre>
'''
let $output := $input => csv:parse($options) => csv:serialize($options)
return $input eq $output
</syntaxhighlightpre>
'''Example 3:''' Converts CSV data to XQuery and returns distinct column values:
)
)
</syntaxhighlightpre>
'''Result:'''
* Name: Jack, John
* City: Chicago, Washington, New York
</syntaxhighlightpre>
=Errors=
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu