how to change the 14th line as changed value, And then save it as .plist file! i am trying to use XmlElement and then save it, but the problem is after i save that file, the doctype line will be ,I mean the "[]" has been added at the end of doctype line which will cause issue when iPhone use this file.in c#, how to edit it in right way?
i use below code to modify .plist file:
XmlDocument doc = new XmlDocument();
string plistPath = "app.plist";
doc.Load(plistPath);
foreach (var node in doc.SelectNodes("//string"))
{
if (node is XmlElement)
{
var elem = (XmlElement)node;
if (elem.InnerText == "software-package")
{
var versionElement = elem.NextSibling.NextSibling as XmlElement;
if (versionElement != null)
{
versionElement.InnerText = "PCDownload Url";
}
}
}
}
doc.Save(plistPath);
and the DOCTYPE line will changed to:< !DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"[]> in .plist file.