title: how to modify a .plist file using c#?
body: <p>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?</p>
  
  <p><img src="https://i.stack.imgur.com/BXrHA.png" alt="app.plist"></p>
  
  <p>i use below code to modify .plist file:</p>
  
  <pre><code>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);
  </code></pre>
  
  <p>and the DOCTYPE line will changed to:&lt; !DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "<a href="http://www.apple.com/DTDs/PropertyList-1.0.dtd" rel="nofollow noreferrer">http://www.apple.com/DTDs/PropertyList-1.0.dtd</a>"[]> in .plist file.</p>