Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSV serialization for result formats of new W3C parsing functions #2363

Closed

Conversation

GuntherRademacher
Copy link
Member

These changes add support for the new CSV parsing result formats to csv:serialize. As for csv:parse result formats, the options that are used at parsing time can be supplied for serialization. For the new functions, these are the options conforming to FnCsvToArrays.CsvToArraysOptions and FnParseCsv.ParseCsvOptions. The actual options class and the serializer implementation are determined by inspecting the first item to be serialized:

Item Type Options Class Serializer
element(fn:csv)
document-node(element(fn:csv))
FnParseCsv.ParseCsvOptions CsvXmlSerializer
element()
document-node()
CsvParserOptions CsvDirectSerializer
array(*) FnCsvToArrays.CsvToArraysOptions CsvArraysSerializer
record(records, *) CsvParserOptions CsvXQuerySerializer
record(*) FnParseCsv.ParseCsvOptions CsvMapSerializer

Class CsvSerializer.Delegator has been added to delay this distiction until the first item is presented to serialize(Item).

Test cases have been added in new class CsvRoundtripTest. These have been generated semi-atomatically by adding some temporary code to collect them while executing QT4 tests. The test cases

  • do some CSV parsing
  • verify that the expected result was returned
  • do CSV serialization of the result
  • parse the result of the serialization
  • verify that the same expected result was returned as was from the initial parsing.

@ChristianGruen
Copy link
Member

Incorporated in 105b63a

@ChristianGruen ChristianGruen deleted the csv-serialization branch January 24, 2025 12:36
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.

2 participants