title: How to select xml root node when root node has attribute?
body: <p>I am trying to select all the child nodes of root node of an xml document using XPath query. </p>
  
  <p>My xml file looks something like following :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt; 
  &lt;root&gt;
      &lt;automotive_industry&gt;
          &lt;automotive /&gt; 
          &lt;rail_global_services /&gt; 
      &lt;/automotive_industry&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>AND</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt; 
  &lt;root xmlns="http://www.my_department.my_company.com/project_name"&gt;
      &lt;automotive_industry&gt;
          &lt;automotive /&gt; 
          &lt;rail_global_services /&gt; 
      &lt;/automotive_industry&gt;
      &lt;/root&gt;
  </code></pre>
  
  <p>C# Code to select root node is as follows :</p>
  
  <pre><code>XmlDocument gazetteDocument = new XmlDocument();
  gazetteDocument.Load(xmlFilePath);
  XmlNodeList allNodes = gazetteDocument.SelectNodes("root");
  </code></pre>
  
  <p>This code works fine, it selects all the child nodes of root node when root node does not have any attribute that is, it works for 1st xml file but does not work for 2nd xml file because 2nd file has xmlns attribute.</p>
  
  <p>Does anyone knows how to select all the child nodes of root node when root node has attributes??</p>
  
  <p><strong>EDIT :</strong>
  I found one XPath query : <code>/*</code> This query selects root node no matter whether it has any attribute or not. Once root node is selected, I can iterate through its all the child nodes .</p>