我想从下面的 URL 中获取相似艺术家的名字,并将它们显示在 listBox 中。
http://ws.audioscrobbler.com/2.0/?method=artist.getsimilar&artist= ARTISTNAMEHERE &api_key=ff1629a695c346cc4b2dd1c41fcd4054
到目前为止,从其他人的问题来看,我已经阅读了 XML 文件:
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
WebClient wc = new WebClient();
wc.DownloadStringCompleted += HttpCompleted;
wc.DownloadStringAsync(new Uri("http://ws.audioscrobbler.com/2.0/?method=artist.getsimilar&artist=ARTISTNAMEHERE&api_key=ff1629a695c346cc4b2dd1c41fcd4054"));
}
private void HttpCompleted(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Error == null)
{
XDocument xdoc = XDocument.Parse(e.Result, LoadOptions.None);
// do something with the XDocument here
}
}
正如我之前所说,我想从该页面获取艺术家姓名,这是每个名称节点并将它们显示在列表框中。我该怎么做呢?