feat: add XML input/output format support#133
Merged
Conversation
- New src/xml.zig: row-based XML parser and writer - writeXmlHeader/writeXmlRow/writeXmlFooter for output - XmlParser struct for input (line/col error tracking, entity decoding) - loadXmlInput, getXmlColumnNames, summarizeXml for all three modes - main.zig: xml added to InputFormat and OutputFormat enums - --xml-root and --xml-row flags to customise element names (defaults: results, row) - XML dispatch in run(), runColumns(), runValidate(), runSample() (fatal) - build.zig: tests 57/58 updated to use parquet as unknown format; 6 new XML integration tests (99-104) - docs and README: updated format lists, new --xml-root/--xml-row flag docs, XML usage example
- xml.zig: fix readName to reject digits as NameStartChar (XML spec) - xml.zig: add numeric character reference support in decodeEntities (&#NNN; / &#xNNN;) - xml.zig: add 13 unit tests for parser, escaping and output functions - main.zig: add MissingXmlFlagValue and InvalidXmlName errors with clear messages - main.zig: validate --xml-root/--xml-row as legal XML names - main.zig: simplify --sample rejection message - build.zig: add 9 integration tests covering edge cases (entities, NULL, empty doc, --sample, self-closing, column order, attributes, float-as-int) - build.zig: wire xml unit tests into test_step and unit-test step - sqlite.zig: extract shared SQLite helpers from json.zig and xml.zig (DRY) - sqlite.zig: remove dead c.sqlite3_free call in commitTransaction
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
xmlas a supported input and output format (-I xml/-O xml)src/xml.zig: hand-written row-based XML parser and writer (no external XML library)--xml-rootand--xml-rowto customise root/row element names (defaults:results/row)--columns,--validate; rejected with a clear error in--sampleFormat
Output (
-O xml):Input (
-I xml): row-based XML where each direct child of the root element is a row and each child of a row element is a column. Entities decoded (&<>"'). Nested elements captured as raw XML strings.Changes
src/xml.zig(new):writeXmlHeader,writeXmlRow,writeXmlFooter,XmlParser,loadXmlInput,getXmlColumnNames,summarizeXmlsrc/main.zig:xmladded toInputFormat/OutputFormatenums;--xml-root/--xml-rowflag parsing; dispatch inrun(),runColumns(),runValidate(),runSample()build.zig: tests 57/58 updated (useparquetas the truly unknown format now); 6 new XML integration tests (99–104)docs/sql-pipe.1.scd+README.md: updated format lists, new flag docs, XML usage exampleCloses #99