title: Working with XDocument
body: <p>I have the following XDocument:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
     &lt;D:multistatus xmlns:D="DAV:" xmlns:Office="urn:schemas-microsoft-com:office:office"    xmlns:Repl="http://schemas.microsoft.com/repl/" xmlns:Z="urn:schemas-microsoft-com:"&gt;
     &lt;D:response&gt;
         &lt;D:href&gt;http://aaa&lt;/D:href&gt;
         &lt;D:propstat&gt;
             &lt;D:prop&gt;
                 &lt;D:displayname&gt;a&lt;/D:displayname&gt;
                 &lt;D:isFolder&gt;t&lt;/D:isFolder&gt;
             &lt;/D:prop&gt;
             &lt;D:status&gt;HTTP/1.1 200 OK&lt;/D:status&gt;
        &lt;/D:propstat&gt;
    &lt;/D:response&gt;
    &lt;D:response&gt;
          .
          .
    &lt;/D:response&gt;  
  </code></pre>
  
  <p>How can I get all the responses? (Everything under "D:response" tag, and obviously everything under "D:propstat" and "D:prop" tags - I want to get D:href, D:displayname, D:isFolder)  </p>
  
  <p>I'm doing this:  </p>
  
  <pre><code>XNamespace d = "DAV:";
  foreach (var file in doc.Descendants(d + "response"))
  {
      if ((string)file.Element(d + "href") != (string)Configuration.Configs["baseUrl"])
      {
          string ref = (string)file.Element(d + "href");
          foreach (var propstat in file.Descendants(d + "propstat"))
              foreach (var prop in propstat.Descendants(d + "prop"))
              {
                  string name = (string)prop.Element(d + "displayname");
                  if (prop.Element(d + "isFolder") != null &amp;&amp; (string)prop.Element(d + "isFolder") == "t")
                      string type = "folder";
                  else
                      string type = "file";
              }
      }
  } 
  </code></pre>
  
  <p>Is there a better way?</p>