title: C # SelectSingleNode - Can it be used recursively?
body: <p>As in, if I have an XML Document</p>
  
  <pre><code>&lt;root a="value"&gt;
      &lt;item name="first"&gt;
          x
          &lt;foo name = "firstgrandchild"&gt;There is nothing here&lt;/foo&gt;
          y
          &lt;foo name = "secondgrandchild"&gt;There is something here&lt;/foo&gt; 
      &lt;/item&gt;
      &lt;item name="second"&gt;
          xy
          &lt;foo/&gt;
          ab
      &lt;/item&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>I want to first find the first occurrence of node "item" and then update the attribute, and then I want to update the first occurrence of node "foo" and then update the attribute etc., </p>
  
  <p>My Code is as below</p>
  
  <pre><code>myDoc.Load("Items2.xml");
  myNode = myDoc.DocumentElement;
  mySearchNode = myNode.SelectSingleNode("/root/item");
  mySearchNode.Attributes["name"].Value = "Joel";
  Console.WriteLine(mySearchNode.OuterXml);
  mySearchChildNode = mySearchNode.SelectSingleNode("/item/foo");
  Console.WriteLine(mySearchChildNode.OuterXml);
  </code></pre>
  
  <p>While, the first search and update of attribute works fine, the second one fails as mySearchNode.SelectSingleNode returns null.</p>
  
  <p>Question - Is there something fundamentally that is wrong with this code?
  Why does not the SelectSingleNode work as expected in the second instance, as far as it is concerned, I am executing it on a XmlNode of type Element. </p>
  
  <p>Kindly assist. </p>
  
  <p>Many Thanks,</p>