Changes

Jump to navigation Jump to search
415 bytes added ,  17:17, 26 October 2017
no edit summary
* If {{Code|format}} is set to {{Code|attributes}}, field names will be stored in name attributes.
'''A little advice''': in the Database Creation dialog of the GUI, if you select CSV Parsing and switch to the ''Parsing'' tab, you can see the effects of some of the conversion options. ===MapXQuery=== {{Mark|Introduced with Version 9.0}}:
If {{Code|format}} is set to {{Code|map}}, the CSV data will records can be converted to an XQuery mapa sequence of arrays:
* All The resulting value will be a map with a {{Code|records are enumerated with positive integers}} and an optional {{Code|names}} key.* By default, all Records are organized as a sequence of arrays. A single array contains the entries of a records are represented in a sequencesingle record.* If the The column names will be available if {{Code|header}} option is set to {{Code|true}}, a map is created, which contains all field names and its values.
'''A little advice''': in the Database Creation dialog of the GUIThe resulting representation will consume less memory than XML-based formats, if you select CSV Parsing and switch to the ''Parsing'' tab, you values can see the effects of some of the be directly accessed without conversion options. Thus, it is recommendable for very large inputs and for efficient ad-hoc processing.
==Options==
|- valign="top"
| {{Code|format}}
| Specifies the format of the XML data. The format is only relevant if the {{Code|header}} option is activated:<br/>
* With {{Code|direct}} conversion, field names are represented as element names
* With {{Code|attributes}} conversion, field names are stored in {{Code|name}} attributes
* With {{Code|mapxquery}} conversion, the input is converted to an XQuery map
| {{Code|direct}}, {{Code|attributes}}, {{Code|map}}
| {{Code|direct}}
</pre>
'''Example 3:''' Converts CSV data to an XQuery map item and serializes its contentsreturns distinct column values:
'''Query:'''
<pre class="brush:xquery">
let $text := "``[Name;,City" || out:nl() || "Jack,ChicagoJack,WashingtonJohn;Newton" || out:nl() || "Jack;Oldtown",New York]``let $options := map { 'separator': ';', 'format' : 'mapxquery', 'header' : true()}return let $data := csv:parse($text, $options)return ( 'Distinct values:', let $records := $data?records for $name at $pos in $data?names?* let $values := $records?($pos) return ( '* ' || $name || ': ' || string-join(distinct-values($values), ', ') ))
</pre>
'''Result:'''
<pre class="brush:xquery">
map { 1Distinct values: map { "City"* Name: "Newton"Jack, "Name": "John" }, 2: map { "* City": "Oldtown"Chicago, "Name": "Jack" }}Washington, New York
</pre>
=Changelog=
 
;Version 9.0
 
* Added: {{Code|xquery}} option
* Removed: {{Code|map}} option
;Version 8.6
Bureaucrats, editor, reviewer, Administrators
12,235

edits

Navigation menu