I have the following XML:
<Axis>
<Collections>
<Collection>
<Client>
<Name>Client 1</Name>
<Value>345</Value>
</Client>
</Collection>
<Collection>
<Client>
<Name>Client 1</Name>
<Value>4532</Value>
</Client>
</Collection>
<Collection>
<Client>
<Name>Client 1</Name>
<Value>235</Value>
</Client>
</Collection>
<Collection>
<Client>
<Name>Client 1</Name>
<Value>8756</Value>
</Client>
</Collection>
<Collection>
<Client>
<Name>Client 1</Name>
<Value>76</Value>
</Client>
</Collection>
</Collections>
<Collections>
<Collection>
<Client>
<Name>Client 2</Name>
<Value>56</Value>
</Client>
</Collection>
<Collection>
<Client>
<Name>Client 2</Name>
<Value>43</Value>
</Client>
</Collection>
<Collection>
<Client>
<Name>Client 2</Name>
<Value>34</Value>
</Client>
</Collection>
<Collection>
<Client>
<Name>Client 3</Name>
<Value>42</Value>
</Client>
</Collection>
<Collection>
<Client>
<Name>Client 3</Name>
<Value>23</Value>
</Client>
</Collection>
</Collections>
</Axis>
and I would like to store some of this in a dictionary Dictionary<string, List<string>> where the key is the name element and the value is a list of the Value elements.
I have mucked around with a bit of LINQ, but I have not been able to work out the dictionary part.
I have been able to get one element into a list:
myDoc.XPathSelectElements("//Axis/Collections/Collection/Client/Value")
.Select(v => v.Value)
.ToList();