1
你好我使用XmlDocument的更新plist中,當我保存它看起來像這樣<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd" []>
錯誤[]在XmlDocument的類型
的<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
打算結束這是我的代碼
UpdatePlist .FS:
namespace TestPlist
open System
open System.Xml
module UpdatePlist =
type PlistLocation = PlistLocation of string
type Version = Version of string
let updatePlist (PlistLocation(plist), Version(stable), Version(revision), Version(last)) =
let mydocument = new XmlDocument()
mydocument.Load(plist)
mydocument.PreserveWhitespace |> ignore
let PlistNodes = mydocument.SelectNodes("descendant::key")
let version = stable + "." + revision + "." + last
PlistNodes.Item(8).NextSibling.InnerText <- version
mydocument.Save(plist)
"done"
和Program.fs:
namespace TestPlist
open UpdatePlist
module Main=
[<EntryPoint>]
let main argv =
updatePlist(PlistLocation("../../Info.plist"), Version("8"), Version("5"), Version("9"))
|> printfn "%A"
而且plist文件的Info.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleExecutable</key>
<string>
</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>LSApplicationCategoryType</key>
<string>
</string>
<key>MinimumOSVersion</key>
<string>8</string>
<key>CFBundleDisplayName</key>
<string></string>
<key>CFBundleIdentifier</key>
<string></string>
<key>CFBundleShortVersionString</key>
<string>8.5.9</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
請幫助!
請修復您的代碼,那麼也許我們可以幫助 – Carsten
修復它,謝謝@Carsten –
我的猜測是,你沒有得到任何幫助你的問題,因爲你讓我們無法重現這個問題。請提供[簡短,獨立,正確(可編譯),示例](http://sscce.org)。 –