title: struggling with XML namespaces (linq)... what am I doing wrong here?
body: <p>Trying to parse some XML but apparently this is too much for a lazy sunday afternoon,</p>
  
  <p>this is my code:  (I Tried the XPathDocument and XmlDocument approach too but this also failed miserably)</p>
  
  <pre><code> XmlDocument xmlDoc = new XmlDocument();
   xmlDoc.LoadXml(postData);
   XDocument xDoc = XDocument.Load(new XmlNodeReader(xmlDoc)); 
   XNamespace soapEnv = "http://schemas.xmlsoap.org/soap/envelope/";
   XElement xEnv = xDoc.Descendants(soapEnv + "Envelope").First();
   XElement xBody = xEnv.Descendants(soapEnv + "Body").First();
   XElement xReadReply = xBody.Descendants("ReadReplyReq").First();
  </code></pre>
  
  <p>The last line fails with the exception: no elements in this collection
  however if I change this last line into:</p>
  
  <pre><code> XElement xReadReply = xBody.Descendants().First();
  </code></pre>
  
  <p>it returns the first node which in fact is the "ReadReplyReq" node.</p>
  
  <p>Having finally gotten these Namespaces working, it now fails on the first node without a namepace...  ooh bitter irony ;^)</p>
  
  <p>This is the XML I'm trying to parse:</p>
  
  <pre><code> &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
        &lt;SOAP-ENV:Header&gt;
             &lt;TransactionID xmlns="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-2" SOAP-ENV:actor="" SOAP-ENV:mustUnderstand="1"&gt;12345678&lt;/TransactionID&gt;
        &lt;/SOAP-ENV:Header&gt;
        &lt;SOAP-ENV:Body&gt;
             &lt;ReadReplyReq xmlns="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-2"&gt;
                  &lt;MMStatus&gt;Read&lt;/MMStatus&gt;
                  &lt;TimeStamp&gt;2007-12-13T14:05:27+01:00&lt;/TimeStamp&gt;
                  &lt;MessageID&gt;54321&lt;/MessageID&gt;
                  &lt;Sender&gt;
                       &lt;ShortCode&gt;+12345&lt;/ShortCode&gt;
                  &lt;/Sender&gt;
                  &lt;Recipient&gt;
                       &lt;Number&gt;+12345&lt;/Number&gt;
                  &lt;/Recipient&gt;
                  &lt;StatusText&gt;Message has been read&lt;/StatusText&gt;
                  &lt;MM7Version&gt;5.3.0&lt;/MM7Version&gt;
             &lt;/ReadReplyReq&gt;
         &lt;/SOAP-ENV:Body&gt;
   &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>what last step am I missing here?</p>
  
  <p>p.s. and why can't the XPath not just be something more intuitive like: "//SOAP-ENV:Envelope/SOAP-ENV:Body/ReadReplyReq/MMStatus", instead of all these crazy hoops one has to jump through.</p>