title: How to get the Element value from returned Soap based XML Message
body: <p>I am to get the element value of Soap based retuned XML as below.</p>
  
  <h2>XML File:</h2>
  
  <pre><code>&lt;soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
    &lt;soap:Body&gt;
      &lt;SendToDSSResponse xmlns="http://tempuri.org/"&gt;
        &lt;SendToDSSResult&gt;
          &lt;RC&gt;0&lt;/RC&gt;
          &lt;RCD&gt;&lt;/RCD&gt;
          &lt;PCKT&gt;
            &lt;IDNO&gt;1212&lt;/IDNO&gt;
            &lt;IDTYPE&gt;051&lt;/IDTYPE&gt;
            &lt;NOBOX&gt;121216&lt;/NOBOX&gt;
            &lt;NAME&gt;James&lt;/NAME&gt;
         &lt;/PCKT&gt;
        &lt;/SendToDSSResult&gt;
      &lt;/SendToDSSResponse&gt;
    &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>Now I want to get the values of IDNO, NoBox and Name. I am trying to use the following code below to get the values but it throws an Exception. What's the correct way to get the element values?</p>
  
  <h2>C# Code:</h2>
  
  <pre><code>var xDoc = XDocument.Parse(cleanXml); //OR XDocument.Load(filename)      
  string Name = xDoc.Descendants("Name").First().Value;
  </code></pre>