<h1>远程操作XML</h1>
/// <summary>
/// XMLDocument.Load GetFile
/// </summary>
public static void SetRemoteXML()
{
string path2 = @"\\192.168.88.80\VSS_DB\XMLFile.xml";
string path = Application.StartupPath + "\\XMLFile.xml";
if (!File.Exists(path2))
{
MessageBox.Show("File inexistence");
return;
}
XmlDocument XDoc = new XmlDocument();
XDoc.Load(path2);
XmlNode node = XDoc.SelectSingleNode("/Sphenis");
if (node.HasChildNodes)
{
Console.WriteLine("Has ChildNodes");
}
XmlNode XNLicenceKey = XDoc.SelectSingleNode("LicenceKey");
XmlElement XELicenceKey = XDoc.DocumentElement["LicenceKey"];
XELicenceKey.InnerText = "LicenceKey";
XDoc.Save(path2);
Console.WriteLine("Save succeed");
}
浙公网安备 33010602011771号