Re: [xml] code generation for C++

Dave Malcolm <david davemalcolm demon co uk> wrote at Thu, 20 Nov 2003 02:24:05 +0000:
On Thu, 2003-11-20 at 01:34, William Brodie-Tyrrell wrote:
(warning: xml n00b)

IIRC, the xmlroff project at SourceForge had something like this, though
it generates GObjects in C, rather than C++ classes.
Can anyone point me at a package that will generate c++ headers and code to
represent (and load using libxml2) a data structure defined by a DTD?  I
hacked one up in Perl but its parser is extremely brain-dead and so supports
only a very limited subset of possible DTDs (it can't handle much more than
the following example).

No, xmlroff uses XSLT to generate C code from the XML version of the
XSL Recommendation, not from a DTD.

I'd suggest converting the DTD to the XML form of Relax-ng and then
using XSLT to generate your C++ classes from the XML.

If you want to stick with Perl, find Earl Hood's perlSGML package that
includes functions for parsing DTDs.


Tony Graham
XML Technology Center - Dublin
Sun Microsystems Ireland Ltd                       Phone: +353 1 8199708
Hamilton House, East Point Business Park, Dublin 3            x(70)19708

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]