title: Read XML Element based on previous element
body: <p>Good day.
  im hoping that somebody could please assist me. i have spent days trying to figure this out without much luck. i have an XML SOAP document which i am trying to get certain values from. below is a snipped of the document.</p>
  
  <pre><code>&lt;Devices isOnline="false"&gt;
          &lt;deviceId&gt;
            &lt;Number&gt;1&lt;/Number&gt;
            &lt;Id&gt;11111&lt;/Id&gt;
          &lt;/deviceId&gt;
          &lt;lastUploadDateTime&gt;2017-07-27&lt;/lastUploadDateTime&gt;
          &lt;Parameters&gt;
            &lt;TempId&gt;22222&lt;/TempId&gt;
            &lt;MappedId&gt;3333&lt;/MappedId&gt;
          &lt;/Parameters&gt;
   &lt;/Devices&gt;
  </code></pre>
  
  <p>i need to first search for in the deviceID to check for a specific ID, if i find a match i then need to go to the pararameters and get the values of the TempID and MappedID elements.</p>
  
  <p>so far i have the following code which loops through the Devices element, but i am unsure of how to check for a specific ID under deviceId and then get the values of TempId and MappedId under Parameters.</p>
  
  <pre><code> XDocument doc = XDocument.Parse(xml);
   XNamespace ns = "http://";
   IEnumerable&lt;XElement&gt; responses = doc.Descendants("Devices");
  
  
   foreach (XElement response in responses)
   {
  
   }
  </code></pre>
  
  <p>Any Assistance would be greatly appreciated. i have tried many examples i have found, but none that are able to get my exact details i require.</p>