title: How to get xml node in c#?
body: <p>I'm trying to get the cost node from an xmldocument, but I can't figure out how to set proper xpath expression. Here's my c# code:</p>
  
  <pre><code>XmlNode n = reportFields.SelectSingleNode(field[1].Trim());
  </code></pre>
  
  <p>field[1] is my xpath, a following string:</p>
  
  <pre><code>"    /Report/Tablix6/RowGroup_Collection/RowGroup/@Cost"
  </code></pre>
  
  <p>and that's part of innerXml property of reportFields:</p>
  
  <pre><code>"&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;
  &lt;Report Name=\"Sample\"&gt;
  &lt;Tablix6&gt;
      &lt;RowGroup_Collection&gt;
          &lt;RowGroup Cost=\"1199\" /&gt;
      &lt;/RowGroup_Collection&gt;
  &lt;/Tablix6&gt;
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>EDIT:</p>
  
  <p>After executing this code n is null.</p>
  
  <p>EDIT2: Here's the updated version of xmlDocument:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; 
  &lt;Report xsi:schemaLocation="Telephony http://serverName" 
  Name="Telephony" 
  Textbox1="Telephony total cost" 
  Textbox6="Updated: 2010-4" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xmlns="Telephony"&gt;
  &lt;Tablix6&gt;
      &lt;RowGroup_Collection&gt;
          &lt;RowGroup CostSEK="13.908239364624" /&gt; 
      &lt;/RowGroup_Collection&gt;
  &lt;/Tablix6&gt;
  </code></pre>