Skip to content

Implement method="csv" serialization (BaseX-inspired)#12

Open
joewiz wants to merge 2 commits intodevelopfrom
feature/csv-serialization
Open

Implement method="csv" serialization (BaseX-inspired)#12
joewiz wants to merge 2 commits intodevelopfrom
feature/csv-serialization

Conversation

@joewiz
Copy link
Copy Markdown
Owner

@joewiz joewiz commented Apr 7, 2026

Summary

Implements a CSV output method for fn:serialize(), modelled on BaseX's csv serialization extension. This is not part of any W3C specification.

This was extracted from v2/serialization-compliance (PR eXist-db#6219) where it was incorrectly attributed to the QT4 Serialization spec. Keeping here as a joewiz/exist draft PR for evaluation before deciding whether to open upstream.

What Changed

  • EXistOutputKeys.java — add CSV_* string constants
  • SerializerUtils.java — register CSV serialization parameters (csv.field-delimiter, csv.row-delimiter, csv.quote-character, csv.header, csv.quotes) and map method="csv"text/csv
  • CSVSerializer.java (new) — CSV serializer implementation
  • XQuerySerializer.java — route method="csv" to CSVSerializer; exclude from XML normalization path
  • csvSerializer.xql (new) — XQSuite tests

Reference

joewiz and others added 2 commits April 7, 2026 16:35
Add a CSV output method for fn:serialize(), modelled on BaseX's
csv serialization extension (https://docs.basex.org/13/XQuery_Extensions#serialization).
This is not part of any W3C specification.

Features:
- Configurable field/row delimiters and quote character
- csv-header parameter for optional column headers
- csv-quotes: needed/all/none quoting strategies
- Array items become fields, sequence items become rows
- Map values as rows with keys as headers

Test: csvSerializer.xql — XQSuite tests for CSV output.

Reference: https://docs.basex.org/13/XQuery_Extensions#serialization

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Completes the CSV serialization feature:
- Add CSV_* string constants to EXistOutputKeys
- Register CSV serialization parameters in SerializerUtils (field/row
  delimiters, quote char, header, quotes strategy) and map method="csv"
  to media type text/csv
- Route method="csv" to CSVSerializer in XQuerySerializer dispatch and
  exclude csv from the XML normalization path (isXmlMethod)
- Remove unused outputProperties field from CSVSerializer

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@joewiz joewiz force-pushed the feature/csv-serialization branch from 333b33f to a9123ee Compare April 7, 2026 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant