求用LINQ to XML查询一非常规xml文件语句
时间:2011-12-21
来源:互联网
文件内容如下:
XML code
要求一、查询CFBundleDisplayName的值,此例值为“支付宝”
要求二:查询CFBundleIconFiles的值,此例值为icon.png、[email protected]
XML code
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Product ID</key> <string>IPHONE_1ND</string> <key>CFBundleName</key> <string>AlipayPortal</string> <key>DTSDKName</key> <string>iphoneos4.2</string> <key>DTXcode</key> <string>0325</string> <key>UTImportedTypeDeclarations</key> <array> </array> <key>Safepay version</key> <string>2.2.4</string> <key>CFBundleDevelopmentRegion</key> <string>zh_CN</string> <key>CFBundleVersion</key> <string>3.1</string> <key>NSMainNibFile</key> <string>MainWindow</string> <key>CFBundleDocumentTypes</key> <array> </array> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleIconFile</key> <string>icon.png</string> <key>User Agent</key> <string>ALIPAY_FOR_IOS</string> <key>DTPlatformName</key> <string>iphoneos</string> <key>CFBundleSupportedPlatforms</key> <array> <string>iPhoneOS</string> </array> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleExecutable</key> <string>AlipayPortal</string> <key>DTCompiler</key> <string>com.apple.compilers.llvm.clang.1_0</string> <key>UIDeviceFamily</key> <array> <integer>1</integer> </array> <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLName</key> <string></string> <key>CFBundleURLSchemes</key> <array> <string>alipay</string> </array> </dict> </array> <key>CFBundleIdentifier</key> <string>com.alipay.iphoneclient</string> <key>CFBundleResourceSpecification</key> <string>ResourceRules.plist</string> <key>CFBundleSignature</key> <string>????</string> <key>UTExportedTypeDeclarations</key> <array> </array> <key>LSRequiresIPhoneOS</key> <true/> <key>CFBundleIconFiles</key> <array> <string>icon.png</string> <string>[email protected]</string> </array> <key>CFBundleDisplayName</key> <string>支付宝</string> <key>DTXcodeBuild</key> <string>10M2423</string> <key>DTPlatformVersion</key> <string>4.2 Seed 2</string> <key>MinimumOSVersion</key> <string>3.0</string> <key>DTPlatformBuild</key> <string>8C134</string> <key>Product Version</key> <string>3.0.1.1025</string> </dict> </plist>
要求一、查询CFBundleDisplayName的值,此例值为“支付宝”
要求二:查询CFBundleIconFiles的值,此例值为icon.png、[email protected]
作者: dreamsme 发布时间: 2011-12-21
C# code
void Main() { XDocument xml=XDocument.Load("c:\\1.xml"); var query=from x in xml.Descendants("dict") where x.Parent.Name=="plist" from y in x.Elements() where y.Value=="CFBundleDisplayName" select y.NextNode; var query1=from x in xml.Descendants("dict") where x.Parent.Name=="plist" from y in x.Elements() where y.Value=="CFBundleIconFiles" select y.NextNode; }
作者: q107770540 发布时间: 2011-12-21
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28