From the XML below how can we extract values of speed 'key values' based on the given deliveryFormat. e.g. The speed values for deliveryFormat key=1 are 2,3,4 and for deliveryFormat key=4 are 5,6,4
The following code gives me the keys for the availableFormats and based on these keys I want to extract the speed key values
XmlDocument results = new XmlDocument();
results.LoadXml(theModel.SearchLog.AvailabilityXML);
var AvailableFormats = results.SelectNodes("//apiResponse/availableFormats/availableFormat/deliveryFormat/@key");
XML
<?xml version="1.0" encoding="UTF-8"?>
<apiResponse>
<availableFormats>
<availableFormat availabilityDate="2014-01-31">
<deliveryFormat key="1">Encrypted Download</deliveryFormat>
<deliveryModifiers/>
<availableSpeeds>
<speed key="2">2 Hours</speed>
<speed key="3">24 Hours</speed>
<speed key="4">4 Days</speed>
</availableSpeeds>
<availableQuality>
<quality key="1">Standard</quality>
<quality key="2">High</quality>
</availableQuality>
</availableFormat>
<availableFormat availabilityDate="2014-01-31">
<deliveryFormat key="4">Paper</deliveryFormat>
<deliveryModifiers/>
<availableSpeeds>
<speed key="5">2 Hours</speed>
<speed key="6">24 Hours</speed>
<speed key="4">4 Days</speed>
</availableSpeeds>
<availableQuality>
<quality key="1">Standard</quality>
<quality key="2">High</quality>
</availableQuality>
</availableFormat>
</availableFormats>
</apiResponse>