【发布时间】:2011-05-18 05:26:53
【问题描述】:
我需要在 WP7 应用程序上加载一个 xml 文件,该文件存储在我的笔记本电脑中。 我使用了在类似主题上找到的代码:
private void button2_Click(object sender, RoutedEventArgs e) { WebClient wc = new WebClient(); wc.DownloadStringCompleted += HttpsCompleted; wc.DownloadStringAsync(new Uri("https://domain/path/file.xml")); }
private void HttpsCompleted(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Error == null)
{
XDocument xdoc = XDocument.Parse(e.Result, LoadOptions.None);
this.textBox1.Text = xdoc.FirstNode.ToString();
}
}
我需要加载的文件路径是C:\test.xml
那么我需要填写 Uri 什么?
我尝试了类似以下的方法:“https://localhost/C:/test.xml”但不起作用
谁能帮帮我?
【问题讨论】:
标签: c# xml windows-phone-7