xml2c reads in an XML file and produces equivalent C source code, suitable for #including in your program. The C version is probably easier deal with in your code. You don't have to read and parse the XML file and then look for the nodes you want; instead you just loop through a bunch of structs. Or maybe you just don't want to distribute extra files with your app, and would rather build them into the executable.
Example input:
<?xml version="1.0" encoding="utf-8" ?> <list> <item id="1" value="17">this item</item> <item id="2" value="23">that item</item> <item id="3" value="42">the other item</item> </list>
Example output:
% xml2c sample.xml struct _item { char* id; char* value; char* TEXT; }; struct _list { struct _item item[3]; int N_item; }; static struct _list list = { { { "1", "17", "this item", }, { "2", "23", "that item", }, { "3", "42", "the other item", } }, 3, };
See the manual entry for more details.