I'm trying to update a node value from a XML file but when I'm trying to do this action is throwing an exception "Additional information: Object reference not set to an instance of an object."
This is what I have:
public void UpdateXMLValues(List<string> values)
{
XmlNode node;
xmldoc = new XmlDocument();
xmldoc.Load(XMLInterfaces);
node = xmldoc.SelectSingleNode("Servers/MYSERVER");
XMLValues = new List<string>(values);
node.Attributes["Host"].Value = XMLValues[0];
xmldoc.Save(XMLInterfaces);
}
and this is my XML information:
<Servers>
<MYSERVER>
<Host>0.0.0.0</Host>
<Port>23</Port>
<User>TestingUser</User>
<Password>/NNfWRStbZsUyc88S5tjhA==</Password>
</MYSERVER>
</Servers>
When I press F11 in the line node.Attributes["Host"].values = XMLValues[0]; I'm getting the error
any idea?