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!

So you have XML fro the declarations already. Presumably your "new shape" is just a mapping from the GCCXML to yours. You didn't actually describe your problem, which is presumably in defining that mapping, or implementing it. (There's a hint of the problem called "size"; is that provided in the GCCXML output? GCCXML is supposed to output program structure information, not implementation detail).
–
Ira BaxterAug 18 '12 at 17:37

1 Answer
1

I dont know if this would help since you are using C++.But if you want to get this done easily you could go for JDOM or JAXB Parser in Java.The JAXB marshaller creates XML while the JAXB unmarshaller parses the XML.I have used JDOMparser to parse an XML including the CDATA section and it works brilliantly.Hope this helps.
May be you might want to have a look at this example.
http://www.mkyong.com/java/jaxb-hello-world-example/