[ServiceContract]
public interface IParametersXMLService
{
[OperationContract, XmlSerializerFormat]
XmlNode GetCommonNode(string path);
[OperationContract, XmlSerializerFormat]
void SetCommonNode(string path, string value);
}
Service implementation:
public XmlNode GetCommonNode(string path)
{
XmlDocument xml = new XmlDocument();
xml.Load(path);
XmlNode node = (XmlNode)xml.DocumentElement;
XmlNode commonNode = node.SelectSingleNode("/blabla/att);
return commonNode;
}
public void SetCommonNode(string path, string value)
{
XmlDocument xml = new XmlDocument();
xml.Load(path);
XmlNode node = (XmlNode)xml.DocumentElement;
XmlNode commonNode = node.SelectSingleNode("/blabla/att");
commonNode.Attributes["List"].Value = value;
}
GetCommonNode
works fine and returns my value.
SetCommonNode
does not change my value.
Maybe I need to save this file after change?
As indicated, you seem to be missing the XML Document save method call.
You should be able to resolve the issue by adding the following:
xml.Save(path);
The following link provides additional details:
http://support.microsoft.com/kb/301233