title: XPath and XPathSelectElement
body: <p>I have the following xml</p>
  
  <pre><code>&lt;root&gt;
     &lt;databases&gt;
        &lt;db1 name="Name1" /&gt;
        &lt;db2 name="Name2" server="myserver" /&gt;
        &lt;db3 name="Name3" /&gt;
     &lt;/databases&gt;
  &lt;root&gt;
  </code></pre>
  
  <p>I've tried everything to read the name of the db2 (="Name2") with all possible combinations of XPath queries, but never get the expected result.</p>
  
  <p>My Code so far:</p>
  
  <pre><code>var query = "root/databases/db2.. "; // here I've tried everything 
  var doc = XDocument.Load("myconfig.xml");
  var dbName =  doc.XPathSelectElement(query);
  </code></pre>
  
  <p>What's the correct query to get my "Name2" (the value of the Attribute) ? </p>
  
  <p>Thanks for your help.</p>