title: Get value from xml element in c#
body: <p>I am trying to get Absoluteentry tag's value from the below xml string, but its displaying objectrefrence not set exception</p>
  
  <pre><code>&lt;?xml version="1.0" ?&gt; 
  &lt;env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"&gt;
    &lt;env:Body&gt;
      &lt;AddResponse xmlns="http://www.sap.com/SBO/DIS"&gt;
        &lt;PickListParams&gt;
          &lt;Absoluteentry&gt;120072&lt;/Absoluteentry&gt; 
        &lt;/PickListParams&gt;
      &lt;/AddResponse&gt;
    &lt;/env:Body&gt;
  &lt;/env:Envelope&gt;
  </code></pre>
  
  <p>Code</p>
  
  <pre><code>XDocument doc = XDocument.Parse(xmlstring);
  doc.Element("Envelope").Element("Body").Element("AddResponse").Element("PickListParams").Element("Absoluteentry").Value;
  </code></pre>