title: Using XDocument to read the root element from XML using C# is not showing the root element
body: <p>I am new to C# programming and trying to update the XML file using C#. Here when I am trying to get the root element using XDocument it is showing the complete script in the file.</p>
  
  <p>Below is my code explanation:</p>
  
  <p>I am having the below function and it is reading the file path from the command line arguments.</p>
  
  <pre><code>private XDocument doc;
  
  public void Update(string filepath)
  {
     string filename = Path.GetFileName(filepath);
  
     doc = xDocument.Load(filepath);
  
     XElement rootelement = doc.Root;
  
  }
  </code></pre>
  
  <p>Into the filepath variable, we are taking the path "E:\BuilderTest\COMMON.wxs"</p>
  
  <p>Then we are loading the file using XDocument.</p>
  
  <p>But when we are trying to get the rootelement from the file, it is not showing the root element. Instead, it is showing the complete data in the file.</p>
  
  <p>But when I am using XmlDocument() instead of XDocument() I am able to see only the root element.</p>
  
  <p>Below is the code using XmlDocument():</p>
  
  <pre><code>private XmlDocument doc;
  
  public void Update(string filepath)
  {
     string filename = Path.GetFileName(filepath);
  
     doc = new XmlDocument();
     doc.Load(filepath);
  
     XmlElement rootelement = doc.DocumentElement;
  }
  </code></pre>
  
  <p>Please help me by providing your valuable inputs on this.</p>