I'm attempting to read the content of a XML file, using XmlTextReader in C#, that has the following structure:
<root>
<person id="0">
<a1>val</a1>
<a2>val</a2>
</person>
<person id="1">
<a1>val</a1>
<a2>val</a2>
</person>
</root>
I'm looking to read the file into a nested dictionary:
Dictionary<string, Dictionary<string, string>> xmldata = new Dictionary<string, Dictionary<string, string>>();
Hoping to produce:
xmldata = {0 => {a1 => val, a2 => val}, 1 => {a1 => val, a2 => val}}
Issues:
1) Not sure this is the best method for storing the xml data read in, would I be better with
<a x="1"></a><a x="2"></a>
for example?
2) Having a few problems successfully populating the relavent dictionaries