Hi Liam,
Liam R E Quin <> writes:
> I gave a talk at Balisage this year about providing APIs for writing XML
> from non-XML data in languages such as C, PHP and Perl (and maybe java),
> as well as JavaScript.
Tim Bray created a C library for generating XML some time ago:
http://www.tbray.org/ongoing/When/200x/2004/02/20/GenxStatus
It is somewhat abandoned now (there hasn't been any updates
since 2004) but it is reasonably complete. We have been using
it for some time now and have added a number of improvements
(e.g., pretty-printing) and fixed a few issues. We can probably
share these if there is interest.
It doesn't have the printf-style API you described in the blog
post (without seeing any use cases, I will reserve my judgements
about whether it is a good idea or not). But you can probably
use genx as a base and perhaps as a lower-level API if/when the
user needs more flexibility.
Boris
--
Boris Kolpackov, Code Synthesis http://codesynthesis.com/~boris/blog
Compiler-based ORM system for C++ http://codesynthesis.com/products/odb
Open-source XML data binding for C++ http://codesynthesis.com/products/xsd
XML data binding for embedded systems http://codesynthesis.com/products/xsde