[英]Reading external XML File on .NET for Windows Phone in C#
我正在嘗試為WP解析.net上C#中的外部 XML文件,所以有人知道WP的.net中XmlUrlResolver
的等效XmlUrlResolver
嗎?
修改此代碼供您使用,用它來讀取JSON中的文件。 基本上是相同的過程。
private void Function()
{
string url = String.Format("**your xaml string here**");
try
{
destination = null;
WebClient webClient = new WebClient();
webClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(EndFunction);
webClient.DownloadStringAsync(new Uri(url));
}
catch
{
///todo: criar if para verificar conexão
MessageBox.Show("Verify your connection and try again!");
}
}
private void EndFunction(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Error != null)
{
MessageBox.Show("Verify your connection and try again!");
}
else
{
// Save the feed into the State property in case the application is tombstoned.
this.State["xml"] = e.Result;
x = ParserXML(e.Result);
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.