Database_Integration: standalone multi-language, multi-fund examples - #7
Merged
Merged
Conversation
Rework Database_Integration so a developer finds a runnable, heavily-commented
example in their own language for BOTH directions (FundsXML -> DB, DB ->
FundsXML), handling multiple nodes (>=2 Funds, multi-Portfolio/Position/
ShareClass/Asset).
- ddl/schema.sql: redesigned multi-fund model (document -> fund -> portfolio
-> position; share_class per fund; document-scoped asset) with 1-based
ordinals so order/duplicates round-trip exactly.
- Standalone same-CLI programs (init/import/export/roundtrip), all verified
locally to produce import==export:
python/fundsxml_db.py (stdlib sqlite3 + lxml)
java/FundsXmlDb.java (sqlite-jdbc, native javax.xml, no JAXB)
javascript/fundsxml_db.mjs (sql.js + @xmldom/xmldom + xpath)
csharp/FundsXmlDb.cs(+csproj) (Microsoft.Data.Sqlite)
- tools/xml_equiv.py: shared normalized comparator proving import file ==
export file (ignores DocumentGenerated timestamp + numeric/whitespace/attr
ordering; child order significant); always paired with XSD validation.
- FundsXML_Files/4.2.9/positions/Multi-Fund_Positions.xml: round-trip-faithful
multi-fund fixture (2 funds, one with 2 portfolios), XSD-valid.
- Oracle/SQLServer/Postgres load+generate SQL updated to the multi-fund
nested-XMLTABLE / grouped-XMLAGG / FOR XML pattern (code references).
- Data_Binding_JSON/python/fundsxml_json.py reworked to the multi-fund shape
(lossless -> xml_equiv-equal on the fixture).
- tools/fetch-tools.sh fetches sqlite-jdbc; CI runs the multi-fund round-trip
in all 4 languages (equivalence + XSD + cross-language) plus the single-fund
sample; setup-node and setup-dotnet added. .gitignore: node_modules, bin/
obj/, macOS metadata.
Verified locally: every language's export is xml_equiv-equal to the fixture
and to each other, and XSD-valid; Mixed-Fund (n=1) still round-trips.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Gives a developer a standalone, runnable, heavily-commented example in their own language for both directions (FundsXML → DB and DB → FundsXML), against the given relational structure, handling multiple nodes (≥2 Funds, multi Portfolio/Position/ShareClass/Asset).
What's new
ddl/schema.sqlredesigned:document → fund → portfolio → position,share_classper fund, document-scopedasset, with 1-based ordinals so order & duplicates round-trip exactly.init/import/export/roundtrip), each self-contained and over-commented as a teaching artifact:python/fundsxml_db.pysqlite3+ lxmljava/FundsXmlDb.javasqlite-jdbc, nativejavax.xml(no JAXB)javascript/fundsxml_db.mjssql.js+@xmldom/xmldom+xpathcsharp/FundsXmlDb.csMicrosoft.Data.Sqlitetools/xml_equiv.pycompares the import file vs the exported-from-DB file, ignoring only the volatileDocumentGeneratedtimestamp and numeric/whitespace/attr-order formatting (child order is significant). Always paired with XSD validation (it intentionally ignoresxmlns).FundsXML_Files/4.2.9/positions/Multi-Fund_Positions.xml(2 funds; one with 2 portfolios; share classes; document-scoped assets), XSD-valid.load_from_fundsxml+generate_fundsxmlSQL updated to the multi-fund nested-XMLTABLE/ grouped-XMLAGG/FOR XMLpattern (code references, not executed).Data_Binding_JSON/python/fundsxml_json.pyreworked to the consistent multi-fund shape (lossless →xml_equiv-equal on the fixture).tools/fetch-tools.shfetchessqlite-jdbc; CI addssetup-node/setup-dotnetand runs the multi-fund round-trip in all four languages (equivalence + XSD + cross-language identity) plus the single-fund sample..gitignore:node_modules/,bin/ obj/, macOS metadata.Verified locally (end-to-end)
Every language's export of the multi-fund fixture is
xml_equiv-equal to the original and to every other language's export, and XSD-valid;Mixed-Fund_Positions.xml(n=1) still round-trips XSD-valid; JSON multi-fund round-trip isxml_equiv-equal.🤖 Generated with Claude Code