【发布时间】:2023-04-03 18:24:02
【问题描述】:
我想知道如何用 Windows Phone 读取这个 xml(文档树如下所示):
<reponse>Please verify your email </reponse>
我想显示一个 MessageBox,其中包含:“请验证您的电子邮件”。
【问题讨论】:
标签: windows-phone-7 xml-parsing
我想知道如何用 Windows Phone 读取这个 xml(文档树如下所示):
<reponse>Please verify your email </reponse>
我想显示一个 MessageBox,其中包含:“请验证您的电子邮件”。
【问题讨论】:
标签: windows-phone-7 xml-parsing
我认为此链接将为您提供有关如何执行此操作的一个很好的概述。 http://windowsphone.interoperabilitybridges.com/articles/android-to-wp7-chapter-7-xml-parsing-in-windows-phone-7-and-android(描述了几种可能性)
我个人会使用 Linq to XML。
还有一个关于使用 Linq to XML 的文章的链接http://www.windowsphonegeek.com/tips/wp7-working-with-xml-reading-filtering-and-databinding
这段代码应该可以工作:
var xmlResult = XDocument.Parse("<reponse>Please verify your email </reponse>");
var responseValue = xmlResult.Element("response").Value;
【讨论】: