I like to do my server side programming in C, but need to inter-operate with some XML.
What I need to write is some function that, given a C structure, or nested structure, and another structure (or nested structures) that describes the elements in the C structure, spits it out as XML. And another function that reads the XML, verifies that it matches the description of the C structures, and populates the C structures.
I'm quite certain this has been done many times before, but there is so much other info about XML out there that I'm not having any luck composing a Google query that doesn't return a lot of unrelated stuff.
I'm not looking for a library - just a few hundred lines of C code to parse the XML.
He is not asking for an XML parser. He is asking for a library that automatically serializes/unserializes a complex C structure to and from XML (which obviously would rely on an XML parser underneath).
Libpdel is old but has support for doing what you want (via the "structs" stuff).
One way you could do it if you don't find any premade libraries or code is to write a toXML() function like the usual toString() functions. Then a toStruct(char*) that deserializes the XML back into the struct
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With