Convertor wanted: C struct to XML schema

Joshua E. Smith jesmith at
Tue Jul 27 15:48:04 BST 1999

I'm not aware of a tool like that, but if you want to write your own, I'd
offer this advice:

1) If the C structs don't exist yet, then write the structs in a simple
language of your own construction, then use Perl to spew forth *both* the C
structs and the XML Schema (and output Java, C++, and XML DTD while you're
at it! ;).  Or, if you can be sufficiently clear in the XML Schema, write
your structs in XML Schema, and spew forth C structs right from that.

2) If the C structs do already exist, you're going to have to parse them.
I had to do that once, and I ended up grabbing a public-domain C lint-like
program called "check" (I can probably figure out where it came from, but
it'll take some looking), munging it up to tolerate ANSI, and then adding
my own code to spew out the output I needed.  The BNF for just parsing
structs isn't very complicated, but in my case, the structs lived in C
header files with prototypes and lots of other stuff which the parser was
going to have to understand to get the stuff it needed.

Hope that helps.

-Joshua Smith

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as: and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list