Creating class hierarchy from text/xml file

Viewed 21

Lets say we have the following text file:

name                      | value
_________________________________
a.attribute_1             | val_0
a.b.attribute_2           | val_1
a.b.attribute_3           | val_2
a.c.attribute_4           | val_3
a.c.d.attribute_5         | val_4
a.e.f.g.attribute_6       | val_5
a.e.f.h.attribute_7       | val_6

Is there a way to parse the string under column 'name' to create hierarchal classes that will assign every attribute the corresponds val in which way that i can access all attributes and do basic operation like:

lets say val_5 = 2 and val_2 = 6

sum = a.e.f.g.attribute_6 + a.b.attribute_3

and expect to get sum = 8.

What tools or generators i have to use ?

thank you.

0 Answers
Related