<?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>Metadata</key>
<dict>
<key>Build</key>
<string>Build</string>
<key>FullVersionString</key>
<string>Version 5.0 (Build 9A334)</string>
<key>ProductBuildVersion</key>
<string>9A334</string>
<key>ProductCopyright</key>
<string>1983-2011 Apple Inc.</string>
<key>ProductName</key>
<string>iPhone OS</string>
<key>ProductVersion</key>
<string>5.0</string>
<key>Version</key>
<string>Version</string>
</dict>
<key>System</key>
<dict>
<key>com.hyt.passwdUI</key>
<dict>
<key>ApplicationType</key>
<string>System</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>PasswdUI</string>
<key>CFBundleExecutable</key>
<string>passwdUI</string>
<key>CFBundleIconFile</key>
<string>icon.png</string>
<key>CFBundleIdentifier</key>
<string>com.hyt.passwdUI</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>PasswdUI</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.1.4</string>
<key>DTPlatformName</key>
<string>iphoneos</string>
<key>DTSDKName</key>
<string>iphoneos2.0</string>
<key>LSRequiresIPhoneOS</key>
<string>YES</string>
<key>MinimumOSVersion</key>
<string>2.0</string>
<key>Path</key>
<string>/Applications/PasswdUI.app</string>
<key>SignerIdentity</key>
<string>Apple iPhone OS Application Signing</string>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>com.iptm.bigboss.sbsettings</key>
<dict>
<key>ApplicationType</key>
<string>System</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>SBSettings</string>
<key>CFBundleExecutable</key>
<string>SBSettings_Exec</string>
<key>CFBundleIdentifier</key>
<string>com.iptm.bigboss.sbsettings</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>SBSettings</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleResourceSpecification</key>
<string>ResourceRules.plist</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>DTPlatformName</key>
<string>iphoneos</string>
<key>DTSDKName</key>
<string>iphoneos2.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>MinimumOSVersion</key>
<string>2.0</string>
<key>Path</key>
<string>/Applications/SBSettings.app</string>
<key>UIApplicationExitsOnSuspend</key>
<true/>
</dict>
<key>com.saurik.WinterBoard</key>
<dict>
<key>ApplicationType</key>
<string>System</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>WinterBoard</string>
<key>CFBundleIconFile</key>
<string>icon.png</string>
<key>CFBundleIconFiles</key>
<array>
<string>icon.png</string>
<string>icon-72.png</string>
<string>icon@2x.png</string>
</array>
<key>CFBundleIdentifier</key>
<string>com.saurik.WinterBoard</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>WinterBoard</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.9</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>0.9</string>
<key>Path</key>
<string>/Applications/WinterBoard.app</string>
<key>SBUsesNetwork</key>
<integer>3</integer>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
<key>libactivator</key>
<dict>
<key>ApplicationType</key>
<string>System</string>
<key>CFBundleExecutable</key>
<string>Activator</string>
<key>CFBundleIconFile</key>
<string>Icon.png</string>
<key>CFBundleIconFiles</key>
<array>
<string>iPadAppIcon.png</string>
<string>icon.png</string>
<string>icon@2x.png</string>
<string>icon-small.png</string>
<string>icon-small@2x.png</string>
</array>
<key>CFBundleIdentifier</key>
<string>libactivator</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
</array>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>DTPlatformName</key>
<string>iphoneos</string>
<key>DTSDKName</key>
<string>iphoneos3.0</string>
<key>LSRequiresIPhoneOS</key>
<string>YES</string>
<key>MinimumOSVersion</key>
<string>3.0</string>
<key>Path</key>
<string>/Applications/Activator.app</string>
<key>UIDeviceFamily</key>
<array>
<string>1</string>
<string>2</string>
</array>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleDefault</string>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</dict>
<key>User</key>
<dict>
<key>com.popcap.ios.Bej3</key>
<dict>
<key>ApplicationDSID</key>
<integer>273607075</integer>
<key>ApplicationType</key>
<string>User</string>
<key>BuildMachineOSBuild</key>
<string>11C74</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>Bejeweled</string>
<key>CFBundleExecutable</key>
<string>Bejeweled</string>
<key>CFBundleIconFiles</key>
<array>
<string>Icon@2x.png</string>
<string>Icon-72.png</string>
<string>Icon.png</string>
<string>Icon-Small-50.png</string>
<string>Icon-Small.png</string>
<string>Icon-Small@2x.png</string>
</array>
<key>CFBundleIdentifier</key>
<string>com.popcap.ios.Bej3</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Bejeweled</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleResourceSpecification</key>
<string>ResourceRules.plist</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.popcap.ios.Bej3</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.popcap.ios.Bej3.From.Bej2</string>
<string>com.popcap.ios.Bej3.From.BejBlitz</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>2053</string>
<key>Container</key>
<string>/private/var/mobile/Applications/22DB7966-D658-426A-9848-E73505D4040B</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvmgcc42</string>
<key>DTPlatformBuild</key>
<string>9A334</string>
<key>DTPlatformName</key>
<string>iphoneos</string>
<key>DTPlatformVersion</key>
<string>5.0</string>
<key>DTSDKBuild</key>
<string>9A334</string>
<key>DTSDKName</key>
<string>iphoneos5.0</string>
<key>DTXcode</key>
<string>0420</string>
<key>DTXcodeBuild</key>
<string>4D199</string>
<key>EnvironmentVariables</key>
<dict>
<key>CFFIXED_USER_HOME</key>
<string>/private/var/mobile/Applications/22DB7966-D658-426A-9848-E73505D4040B</string>
<key>HOME</key>
<string>/private/var/mobile/Applications/22DB7966-D658-426A-9848-E73505D4040B</string>
<key>TMPDIR</key>
<string>/private/var/mobile/Applications/22DB7966-D658-426A-9848-E73505D4040B/tmp</string>
</dict>
<key>LSRequiresIPhoneOS</key>
<false/>
<key>MinimumOSVersion</key>
<string>3.1</string>
<key>Path</key>
<string>/private/var/mobile/Applications/22DB7966-D658-426A-9848-E73505D4040B/Bejeweled.app</string>
<key>ProfileValidated</key>
<true/>
<key>ServerEnvironment</key>
<string>live</string>
<key>SignerIdentity</key>
<string>TDMTANF Bypass</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
</array>
<key>UIInterfaceOrientation</key>
<string>UIInterfaceOrientationPortrait</string>
<key>UIPrerenderedIcon</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>opengles-2</string>
<string>armv7</string>
</array>
<key>UIStatusBarHidden</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array/>
</dict>
<key>info.rguide.gzmtr</key>
<dict>
<key>ApplicationDSID</key>
<integer>273607075</integer>
<key>ApplicationType</key>
<string>User</string>
<key>BuildMachineOSBuild</key>
<string>10K549</string>
<key>CFBundleDevelopmentRegion</key>
<string>zh_CN</string>
<key>CFBundleDisplayName</key>
<string>gzmtr</string>
<key>CFBundleExecutable</key>
<string>gzmtr</string>
<key>CFBundleIconFile</key>
<string>icon.png</string>
<key>CFBundleIconFiles</key>
<array>
<string>icon.png</string>
<string>icon@2x.png</string>
</array>
<key>CFBundleIdentifier</key>
<string>info.rguide.gzmtr</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>gzmtr</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleResourceSpecification</key>
<string>ResourceRules.plist</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
</array>
<key>CFBundleVersion</key>
<string>4.6</string>
<key>Container</key>
<string>/private/var/mobile/Applications/8F41B3CB-733C-49B4-A5B0-8DD7C7FE2F54</string>
<key>DTCompiler</key>
<string></string>
<key>DTPlatformBuild</key>
<string>9A334</string>
<key>DTPlatformName</key>
<string>iphoneos</string>
<key>DTPlatformVersion</key>
<string>5.0</string>
<key>DTSDKBuild</key>
<string>9A334</string>
<key>DTSDKName</key>
<string>iphoneos5.0</string>
<key>DTXcode</key>
<string>0420</string>
<key>DTXcodeBuild</key>
<string>4C199</string>
<key>EnvironmentVariables</key>
<dict>
<key>CFFIXED_USER_HOME</key>
<string>/private/var/mobile/Applications/8F41B3CB-733C-49B4-A5B0-8DD7C7FE2F54</string>
<key>HOME</key>
<string>/private/var/mobile/Applications/8F41B3CB-733C-49B4-A5B0-8DD7C7FE2F54</string>
<key>TMPDIR</key>
<string>/private/var/mobile/Applications/8F41B3CB-733C-49B4-A5B0-8DD7C7FE2F54/tmp</string>
</dict>
<key>MinimumOSVersion</key>
<string>3.0</string>
<key>NSMainNibFile</key>
<string>MainWindow</string>
<key>Path</key>
<string>/private/var/mobile/Applications/8F41B3CB-733C-49B4-A5B0-8DD7C7FE2F54/gzmtr.app</string>
<key>ProfileValidated</key>
<true/>
<key>SignerIdentity</key>
<string>TDMTANF Bypass</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
</array>
<key>UILaunchImageFile</key>
<string>Default.png</string>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleBlackOpaque</string>
</dict>
<key>com.tencent.xin</key>
<dict>
<key>ApplicationDSID</key>
<integer>273607075</integer>
<key>ApplicationType</key>
<string>User</string>
<key>CFBundleDevelopmentRegion</key>
<string>zh_CN</string>
<key>CFBundleDisplayName</key>
<string>微信</string>
<key>CFBundleDocumentTypes</key>
<array/>
<key>CFBundleExecutable</key>
<string>MicroMessenger</string>
<key>CFBundleIdentifier</key>
<string>com.tencent.xin</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>MicroMessenger</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleResourceSpecification</key>
<string>ResourceRules.plist</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.tencent.xin</string>
<key>CFBundleURLSchemes</key>
<array>
<string>weixin</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>3.1</string>
<key>Container</key>
<string>/private/var/mobile/Applications/9F0F19DE-7530-421A-9A14-FE32567992A9</string>
<key>DTCompiler</key>
<string>4.2</string>
<key>DTPlatformBuild</key>
<string>8C134</string>
<key>DTPlatformName</key>
<string>iphoneos</string>
<key>DTPlatformVersion</key>
<string>4.2 Seed 2</string>
<key>DTSDKName</key>
<string>iphoneos4.2</string>
<key>DTXcode</key>
<string>0325</string>
<key>DTXcodeBuild</key>
<string>10M2423</string>
<key>Entitlements</key>
<dict>
<key>application-identifier</key>
<string>532LCLCWL8.com.tencent.xin</string>
<key>aps-environment</key>
<string>production</string>
<key>keychain-access-groups</key>
<array>
<string>532LCLCWL8.com.tencent.xin</string>
</array>
</dict>
<key>EnvironmentVariables</key>
<dict>
<key>CFFIXED_USER_HOME</key>
<string>/private/var/mobile/Applications/9F0F19DE-7530-421A-9A14-FE32567992A9</string>
<key>HOME</key>
<string>/private/var/mobile/Applications/9F0F19DE-7530-421A-9A14-FE32567992A9</string>
<key>TMPDIR</key>
<string>/private/var/mobile/Applications/9F0F19DE-7530-421A-9A14-FE32567992A9/tmp</string>
</dict>
<key>Icon files</key>
<array>
<string>icon.png</string>
<string>icon@2x.png</string>
</array>
<key>LSRequiresIPhoneOS</key>
<false/>
<key>MinimumOSVersion</key>
<string>3.0</string>
<key>NSMainNibFile</key>
<string>MainWindow</string>
<key>Path</key>
<string>/private/var/mobile/Applications/9F0F19DE-7530-421A-9A14-FE32567992A9/MicroMessenger.app</string>
<key>SignerIdentity</key>
<string>Apple iPhone OS Application Signing</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
</array>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleBlackOpaque</string>
</dict>
</dict>
</dict>
</plist>
求用C#解决:
一、循环读取各节点的CFBundleDisplayName值和Path值,注意有部分节点比如com.saurik.WinterBoard和libactivator没有CFBundleDisplayName值,这种情况则取CFBundleName的值。相要的结果是:
Name:PasswdUI,Path:/Applications/PasswdUI.app
Name:SBSettings,Path:/Applications/SBSettings.app
Name:WinterBoard,Path:/Applications/WinterBoard.app
Name:Activator,Path:/Applications/Activator.app
Name:Bejeweled,Path:/private/var/mobile/Applications/22DB7966-D658-426A-9848-E73505D4040B/Bejeweled.app
Name:微信,Path:/private/var/mobile/Applications/9F0F19DE-7530-421A-9A14-FE32567992A9/MicroMessenger.app
Name:gzmtr,Path:/private/var/mobile/Applications/8F41B3CB-733C-49B4-A5B0-8DD7C7FE2F54/gzmtr.app
二、根据第一个问题中取得的Name值,注意可能是CFBundleDisplayName值,也可能是CFBundleName值,查找图标文件名称,按以下顺序分几种情况判断:
1、节点中有CFBundleIconFiles,返回CFBundleIconFiles值
比如用WinterBoard查找,返回的值是:icon.png,icon-72.png,icon@2x.png
比如用Bejeweled查找,返回的值是:Icon@2x.png,Icon-72.png,Icon.png,Icon-Small-50.png,Icon-Small.png,Icon-Small@2x.png
2、节点中没有CFBundleIconFiles,但有CFBundleIconFile,返回CFBundleIconFile值
比如用PasswdUI查找,返回的值是:icon.png
3、即没有CFBundleIconFiles又没有CFBundleIconFile,返回Null值
比如用SBSettings查找,返回的值是:Null
4、还有一种不规范的情况
比如微信,它的图标标签是
<key>Icon files</key>
<array>
<string>icon.png</string>
<string>icon@2x.png</string>
</array>
用的既不是CFBundleIconFiles又不是CFBundleIconFile,或许还有其它类似写法,但不一定是Icon files。这种情况如果可以处理就返回图标文件名,不能处理就返回Null
请大牛给出可以运行的代码,谢谢!
帮你写了下第一点,第二点其实和第一点差不多,你自己先写写。无非就是判断,假如key等于这个名称的有就取它,如果没有就查找key是另一个名称的节点。第一点如下:
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
xmlDoc.Load(xml);
System.Xml.XmlNodeList dictNodes = xmlDoc.DocumentElement.SelectNodes("//dict");
foreach (System.Xml.XmlNode dictNode in dictNodes)
{
System.Xml.XmlNode xnNameKey = dictNode.SelectSingleNode("./key[text()=\"CFBundleDisplayName\"]");
if (xnNameKey == null)
{
xnNameKey = dictNode.SelectSingleNode("./key[text()=\"CFBundleName\"]");
}
if (xnNameKey != null)
{
System.Xml.XmlNode xnPathKey = dictNode.SelectSingleNode("./key[text()=\"Path\"]");
System.Xml.XmlNode xnName = xnNameKey.NextSibling;
System.Xml.XmlNode xnPath = xnPathKey.NextSibling;
if (xnPathKey != null)
{
Console.WriteLine("Name:" + xnName.InnerText + ",Path:" +xnPath.InnerText);
}
}
}
非常感谢,按照您的指点,问题二也解决了。
这些东东还是自己学的好,我给你一个示例,看看能不能给你一些帮助
解释我就不写了,你建一个项目试试,相信你能看懂的
XML文件:
<Database>
<Table name="expenses"> <EXPENSES_ID>12963294721309797356345</EXPENSES_ID> <USER_ID>1</USER_ID>
<DATE_TIME_STAMP>2011年10月17日</DATE_TIME_STAMP> <NAME>w</NAME> <PRICE>2</PRICE> <NUMBER>2</NUMBER>
<TYPE></TYPE>
</Table>
</Database>
代码:
public static string[] query(string nodePath)
{
List<String> list = new List<string>();
//XmlNode rnode;
//穿件xmldocument实例并且加载Xml数据
XmlDocument doc = new XmlDocument();
doc.Load(Main.PATH);
XmlNodeList nodelist = doc.SelectNodes(nodePath);
foreach (XmlNode node in nodelist)
{
list.Add(node.InnerText);
//row["NAME"] = node.InnerText;
//table.Rows.Add(row);
}
string[] array = list.ToArray();
return array;
}
调用方法:
string namePath = "/Database/Table/NAME"; //得到所有的NAME值并用数组保存
string[] nameArray = XMLHelper.query(namePath);
正在学习中,貌似您这个方法未能解决问题
@dreamsme:文字太多了,下午再看看,吃饭去....