ios - how to modify a .plist file using c#? -


how change 14th line changed value, , save .plist file! trying use xmlelement , save it, problem after save file, doctype line ,i mean "[]" has been added @ end of doctype line cause issue when iphone use file.in c#, how edit in right way?

app.plist

i use below code modify .plist file:

xmldocument doc = new xmldocument();         string plistpath = "app.plist";         doc.load(plistpath);      foreach (var node in doc.selectnodes("//string"))         {             if (node xmlelement)             {                 var elem = (xmlelement)node;                 if (elem.innertext == "software-package")                 {                     var versionelement = elem.nextsibling.nextsibling xmlelement;                     if (versionelement != null)                     {                         versionelement.innertext = "pcdownload url";                     }                 }             }         }         doc.save(plistpath); 

and doctype line changed to:< !doctype plist public "-//apple//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"[]> in .plist file.

i think issue has xmldocument.save() method. know, xml , plist files different, save() method trying apply xml properties plist when saving.

here options:

1) use regular expressions. buffer file contents byte[], make changes using regular expressions, , write buffer .plist.

2) parse document using xml parser, don't use built in save() method. may still result in unwanted modifications in plist file, it's worth shot.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -