Implement method="csv" serialization (BaseX-inspired)#12
Open
Implement method="csv" serialization (BaseX-inspired)#12
Conversation
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>
333b33f to
a9123ee
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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— addCSV_*string constantsSerializerUtils.java— register CSV serialization parameters (csv.field-delimiter,csv.row-delimiter,csv.quote-character,csv.header,csv.quotes) and mapmethod="csv"→text/csvCSVSerializer.java(new) — CSV serializer implementationXQuerySerializer.java— routemethod="csv"toCSVSerializer; exclude from XML normalization pathcsvSerializer.xql(new) — XQSuite testsReference