Hey folks,
quick heads-up: I've started porting
https://github.com/LandrixSoftware/XRechnung-for-Delphi (GPL lib for German/EU e-invoices — XRechnung 3.0, ZUGFeRD/Factur-X, Peppol BIS 3.0) to FreePascal. First stage is done and it actually works.
The FPC code sits next to the Delphi code via {$IFDEF FPC}, so it's one source tree. The Delphi Xml.XMLDoc write path is mapped onto fcl-xml through a tiny shim — plain FPC ≥ 3.2.2, no Lazarus needed.
And it's verified, not just "compiles": the Delphi version produces golden XML files, the FPC build regenerates them, and a canonical DOM compare says:
PASS: 102/102 golden files identical
Two FPC gotchas that ate my afternoon, in case they save yours:
umlauts in string literals → you need {$codepage utf8} in the unit (-FcUTF8 and a BOM didn't cut it for UnicodeString literals on 3.2.2).
TStringStream.DataString reinterpreted my UTF-8 as UTF-16 → garbage. TMemoryStream + UTF8ToString fixed it (same trap with Base64).
Right now it's the write path only (enough to emit every format), Windows/x86_64 tested. If there's interest, I'd be happy to tackle the read/parse path next (currently MSXML-based, hence Windows-only) and maybe take a swing at porting
https://github.com/LandrixSoftware/ZUGFeRD-for-Delphi too.
Let me know if that'd be useful to anyone — and shout if you've got a preferred approach for the reader (fcl-xml XPath vs. manual DOM walk).
Sven