Ok, I've got the following XML tree
<root>
<A>
<A1>
<A1A>1000</A1A>
<A1B>2000</A1B>
<A1C>3000</A1C>
</A1>
<A2>
<A2A>4000</A2A>
<A2B>5000</A2B>
</A2>
</A>
<B>
<B1>
<B1A>6000</B1A>
</B1>
</B>
</root>
From a method receiving an XDocument I want to produce a dictionary where the key is the path (really an XPath) and the value comes from the value in the corresponding leaf.
root/A/A1/A1A 1000
root/A/A1/A1B 2000
root/A/A1/A1C 3000
root/A/A2/A2A 4000
root/A/A2/A2B 5000
root/B/B1/B1A 6000
Seems simple to do in Linq to XML but I can't wrap my head around it.