I'm writing a C/C++ Header file parser that converts .h files into a specific XML format.
I have a structure defined as follows:
struct struct1
{
struct structchild1
{
float child2;
} child3;
unsigned int child3;
};
I want the above structure to be represented as:
<tag1= "struct1">
<name>struct1</name>
<input_type>byte</input_type>
<method></method>
<tag_ref = "structchild1">
<name>child3</name>
<tag2 = "child2">
<name>child2<name>
<size>4<size>
</tag2>
</tag_ref>
<tag2= "child3">
<name>child3</name>
<len>4</len>
<value> </value>
</tag2>
</tag1>
My approach: I'm using a 2 stage process, I first convert the header file into a gccXML format and then use xerces-C++ for visual studio to print the results out into the XML file. I'm successfully able to parse everything (enums, typedefs etc) except nested structures or unions. Can somebpdy please help me out as to how to go about doing this? Thanks!