We built Luventra, a converter that turns a bank's CSV export into OFX, QBO or QFX entirely in the browser. Parsing the CSV was the expected hard part. The surprise was how much of the work was the output format. These are the rules that cost the most time.
1. Leaf elements have no closing tag
OFX 1.x is SGML, not XML. A leaf element is written open-only:
<TRNAMT> -42.10 <FITID> ABC123
Enter fullscreen mode
Exit fullscreen mode
Only aggregates, the elements that contain other elements, get a closing tag. Emit well-formed XML and Quicken and QuickBooks reject the file.
So the writer makes the mistake impossible instead of relying on anyone to remember. It has open() and close() for aggregates and a leaf() that physically cannot produce a close tag.
2.…