Searching in XML using Xpath
<p>I have an XML file like below , using xpath and xnavigator how can get the Value of the supplied Tag Attribute for example if i supply RangeName i should get AssumptClient</p>

<pre><code>&lt;Validations&gt;
    &lt;FieldInfo id="1"&gt;
      &lt;Name&gt;OMID&lt;/Name&gt;
      &lt;Mandatory&gt;Yes&lt;/Mandatory&gt;
      &lt;RangeName&gt;AssumptOMID&lt;/RangeName&gt;
      &lt;DataType&gt;int&lt;/DataType&gt;
      &lt;MaxLength&gt;10&lt;/MaxLength&gt;
    &lt;/FieldInfo&gt;
    &lt;FieldInfo id="2"&gt;
      &lt;Name&gt;ClientName&lt;/Name&gt;
      &lt;Mandatory&gt;Yes&lt;/Mandatory&gt;
      &lt;RangeName&gt;AssumptClient&lt;/RangeName&gt;
      &lt;DataType&gt;string&lt;/DataType&gt;
      &lt;MaxLength&gt;50&lt;/MaxLength&gt;
    &lt;/FieldInfo&gt;
    &lt;FieldInfo id="3"&gt;
      &lt;Name&gt;OppName&lt;/Name&gt;
      &lt;Mandatory&gt;Yes&lt;/Mandatory&gt;
      &lt;RangeName&gt;AssumptProjectName&lt;/RangeName&gt;
      &lt;DataType&gt;string&lt;/DataType&gt;
      &lt;MaxLength&gt;50&lt;/MaxLength&gt;
    &lt;/FieldInfo&gt;
    &lt;FieldInfo id="4"&gt;
      &lt;Name&gt;OperatingGroup&lt;/Name&gt;
      &lt;Mandatory&gt;Yes&lt;/Mandatory&gt;
      &lt;RangeName&gt;AssumptOperatingGroup&lt;/RangeName&gt;
      &lt;DataType&gt;string&lt;/DataType&gt;
      &lt;MaxLength&gt;50&lt;/MaxLength&gt;
    &lt;/FieldInfo&gt;
&lt;/Validations&gt;
</code></pre>

<p>for now i am using the below code</p>

<pre><code>XPathDocument doc;
XPathNavigator nav;
XPathExpression expr;
XPathNodeIterator iterator;
doc = new XPathDocument(strConfigFile);
nav = doc.CreateNavigator();

expr = nav.Compile("/configuration/Validations/FieldInfo[RangeName='AssumptClient']");
iterator = nav.Select(expr);

if (iterator.MoveNext())
{

XPathNavigator nav2 = iterator.Current.Clone();

textBox1.Text = nav2.GetAttribute("RangeName", "");

}
</code></pre>
