Difference between revisions of "CSV Module"
Jump to navigation
Jump to search
Line 28: | Line 28: | ||
* or as map, which contains all key/value pairs: | * or as map, which contains all key/value pairs: | ||
<pre class="brush:xquery"> | <pre class="brush:xquery"> | ||
− | { 'separator' : ';', ... } | + | { 'separator': ';', ... } |
</pre> | </pre> | ||
Revision as of 23:35, 23 September 2013
This XQuery Module contains a single function to parse CSV input. CSV (comma-separated values) is a popular representation for tabular data, exported e. g. from Excel.
Conventions
All functions in this module are assigned to the http://basex.org/modules/csv
namespace, which is statically bound to the csv
prefix.
All errors are assigned to the http://basex.org/errors
namespace, which is statically bound to the bxerr
prefix.
CSV Functions
csv:parse
Signatures | csv:parse($input as xs:string) as element(csv) csv:parse($input as xs:string, $options as item()) as element(csv)
|
Summary | Converts the CSV data specified by $input to XML, and returns the result as element(csv) value.The $options argument can be used to control the way the input is converted. The following options are available:
Options can either be specified
<csv:options> <csv:separator value=';'/> ... </csv:options>
{ 'separator': ';', ... } |
Errors | BXCS0001 : the specified separator must be a single character.
|
Errors
Code | Description |
---|---|
BXCS0001
|
The specified separator must be a single character. |
Changelog
The module was introduced with Version 7.7.2.