I tried to update this small xml example file without success. It is not giving me any error but the file remains unchanged. Any ideas ?
Thanks
XML Sample:
<test>
<user>John Doe</user>
<user>Jane Doe</user>
</test>
C# Code
XmlDocument doc = new XmlDocument();
doc.Load("../../../test.xml");
XmlNode sNode = doc.SelectSingleNode("/test/user");
XmlAttribute users = sNode.Attributes["user"];
if (users != null)
{
string currentValue = users.Value;
if (string.IsNullOrEmpty(currentValue))
{
users.Value = "Thomas";
}
}
doc.Save("../../../test1.xml");