Hi,
I am putting together a DOM parser for an XML file that
I will be using. There is a visible tree which
maps to the data in the XML file and that portion
is working.
I am struggling somewhat with how to store this data
internally. I need to be able to access and update it.
My data takes the form: (where there may be 50 device entries)
<device name="dev 01">
<attribute name="type" value="dev1" />
<attribute name="Address" value="1" />
<attribute name="Gain" value="1.275" />
<attribute name="Offset" value="8.275" />
<attribute name="Manufacturer" value="Widget company" />
</device>
<device name="dev 02">
<attribute name="type" value="dev1" />
<attribute name="Address" value="1" />
<attribute name="Gain" value="1.275" />
<attribute name="Offset" value="8.275" />
<attribute name="Manufacturer" value="Different Widget company" />
</device>
I was thinking of QHash, but I'm not sure that is sufficient and I need
some 50 QHash containers.
For a given device name, I want to be able to recover the "value" for
a given "name".
In addition I would like to be able to handle different types of
data, ie text, integer and float.
I could store my data as all QStrings, but somehow when I need
to perform calculations I need to be able to know whether data is
"int" or "float", etc.
Something like:
double m_offset = HashTableItem.value("dev 02", "Offset");
which would return the floating point "Offset" value for the "dev 02" entry.
integer m_address = HashTableItem.value("dev 01", "Address");
which would return the integer "Address" value for the "dev 01" entry.
Hope I'm not too far of course here..
Many thanks...
Mark
Bookmarks