(I imagine you are parsing an Xml file)
We will assume that you have a bunch of nodes. Each node can make a difference, it can be one of many relatives, and it can have children. This will give you a structure like:
struct Node { DATA Value; DATATYPE Type; Node* nextSibling; Node* firstChild; };
DATA can be a union, as you described, or separate variables. However, since you will be reading values from it in the same form as you saved them, the union should be in order. DATATYPE must be an enumeration.
James curran
source share