title: Removing nodes from XDocument
body: <p>This removes all elements from the document:</p>
  
  <pre><code>        XDocument document = XDocument.Load(inputFile);
          foreach (XElement element in document.Elements())
          {
              element.Remove();
          }
          document.Save(outputFile);
  </code></pre>
  
  <p>This doesn't have any effect:</p>
  
  <pre><code>        XDocument document = XDocument.Load(inputFile);
          foreach (XElement element in document.Elements())
          {
              //element.Remove();
              foreach (XElement child in element.Elements())
                  child.Remove();
          }
          document.Save(outputFile);
  </code></pre>
  
  <p>Am I missing something here? Since these are all references to elements within the XDocument, shouldn't the changes take effect? Is there some other way I should be removing nested children from an XDocument?</p>
  
  <p>Thanks!</p>