有没有一种简单的方法将Nokogiri XML文档转换为Hash?
像Rails这样的东西Hash.from_xml.
如果在另一个哈希中找到特定键,我需要排除在我的应用程序的 Info.plist 中找到的特定键。目前我可以像这样访问 Info.plist 中的各个键
setting4Str = `/usr/libexec/PlistBuddy -c \"print :MySettingsDict:setting4" {settings_file}`
Run Code Online (Sandbox Code Playgroud)
我可以在 plist 字典中的这个键上设置“设置 4 文本”字符串......
但是,我希望能够遍历此 MysettingsDict 的所有键。有没有人有将 iOS XML plist 转换为 ruby 字典的方法?
<?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>CFBundleDisplayName</key>
<string>My App</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.company.appname</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>de</string>
<string>it</string>
<string>fr</string>
<string>ru</string>
<string>es</string>
</array>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.3.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.company.mySchemeName</string>
<key>CFBundleURLSchemes</key>
<array>
<string>mySchemeName</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.3.15.04170</string>
<key>Internal version</key> …Run Code Online (Sandbox Code Playgroud)