I have this xml file:

```
<students>
<student>
    <name>Mark</name>
    <age>20</age>
</student>
<student>
    <name>Adam</name>
    <age>32</age>
</student>

```

I want to change the age of Adam, for that I did:

```
XmlDocument doc = new XmlDocument();
doc.Load("/path/to/sutdents.xml");
XmlNode n = doc.SelectSingleNode("/students/student[name='" + student.name + 
"']");
if (n != null)
{
   n.SelectNodes("age").Item(0).FirstChild.Value = new_value;
}

```

but I get "n" as a null value.
I tried another way to do that by searching for the node using foreach and make change, but I get Null Exception: 

```
XmlDocument doc = new XmlDocument();
doc.Load("/path/to/sutdents.xml");
XmlNodeList nodes = doc.SelectNodes("/students/student");
foreach (XmlNode node in nodes)
 {
   if (node.FirstChild.InnerText == student.name)
    {
     node.SelectSingleNode("age").InnerText = new_value;
    }
  }

```

what I missing here please?
Thanks in advance