Changes

Jump to navigation Jump to search
162 bytes added ,  14:17, 20 July 2022
no edit summary
{| class="wikitable sortable" width="100%"
|- valign="top"
! width="140" | Option! width="50%" | Description
! Allowed
! Default
| {{Code|comma}}, {{Code|semicolon}}, {{Code|colon}}, {{Code|tab}}, {{Code|space}} or a ''single character''
| {{Code|comma}}
| ''parse'', ''serialize''
| {{Code|semicolon}} or {{Code|comma}}, depending on the region
|- valign="top"
| Indicates if the first line of the parsed or serialized CSV data is a table header.
| {{Code|yes}}, {{Code|no}}
| {{Code|no}}
| ''parse'', ''serialize''
| {{Code|no}}
|
|- valign="top"
|- valign="top"
| {{Code|allow}}
| Introduced with {{Mark|BaseX 9.7}}: In Excel, a value will be interpreted evaluated if it starts with the character {{Code|-}}, {{Code|+}}, <code>=</code>, {{Code|@}}, TAB {{Code|\t}} or CR{{Code|\r}}. A regular expression can be specified to reject data that will be rendered handled differently than expected by an application, or that may be malicious (see https://owasp.org/www-community/attacks/CSV_Injection for more details).
| ''string''
| {{Code|no}}
| ''serialize''
| <code><nowiki>[^-+=@&#9;&#13;\t\r].*|[-+]\d?*(\[,.]\d+)?</nowiki></code>
|}
=Functions=
==csv:parsedoc==
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|csv:parsedoc|$string uri as xs:string?|item()?}}<br/>{{Func|csv:parsedoc|$string uri as xs:string?, $options as map(*)?|item()?}}<br />|-valign="top"
| '''Summary'''
|Converts Fetches the CSV document referred to by the given {{Code|$stringuri}} and converts it to an XQuery value. The {{Code|$options}} argument can be used to control the way the input is converted.|-valign="top"
| '''Errors'''
|{{Error|parse|#Errors}} the specified input cannot be parsed as CSV document.<br/>{{Error|options|#Errors}} the specified options are conflicting.
|}
==csv:docparse==
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|csv:docparse|$uri string as xs:string?|item()?}}<br />{{Func|csv:docparse|$uri string as xs:string?, $options as map(*)?|item()?}}<br />|-valign="top"
| '''Summary'''
|Fetches Converts the CSV document referred to by the given {{Code|$uristring}} and converts it to an XQuery value. The {{Code|$options}} argument can be used to control the way the input is converted.|-valign="top"
| '''Errors'''
|{{Error|parse|#Errors}} the specified input cannot be parsed as CSV document.<br/>{{Error|options|#Errors}} the specified options are conflicting.
|}
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|csv:serialize|$input as item()?|xs:string}}<br/>{{Func|csv:serialize|$input as item()?, $options as map(*)?|xs:string}}
|-valign="top"
| '''Summary'''
|Serializes the specified {{Code|$input}} as CSV, using the specified {{Code|$options}}, and returns the result as string.
* The parameter {{Code|method}} needs to be set to {{Code|csv}}, and
* the options presented in this article need to be assigned to the {{Code|csv}} parameter.
|-valign="top"
| '''Errors'''
|{{Error|serialize|#Errors}} the input cannot be serialized.
! width="110"|Code
|Description
|-valign="top"
|{{Code|parse}}
| The input cannot be parsed.
|-valign="top"
|{{Code|serialize}}
| The node cannot be serialized.
;Version 9.4
* Added: [[#csv:doc{{Function||csv:doc]]}}
; Version 9.1
* Updated: [[#csv:parse{{Function||csv:parse]] }} can be called with empty sequence.
;Version 9.0
;Version 7.8
* Updated: [[#csv:parse{{Function||csv:parse]] }} now returns a document node instead of an element, or an XQuery map if {{Code|format}} is set to {{Code|map}}.
* Added: {{Code|format}} and {{Code|lax}} options
The module was introduced with Version 7.7.2.
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu