0
私はxml解析を使用してデータを取得するアプリケーションを開発中です。インターネットでの検索がほとんど行われなくなり、最終的に私の必要性に合ったコードが見つかりました。ノートとして、私はMainPage.xaml.csxmlはこのようにしてMainViewModelで解析します
try
{
if (e.Error != null)
{
MessageBox.Show(e.Error.ToString(), "Error", MessageBoxButton.OK);
}
XElement profiler = XElement.Parse(e.Result);
listBox2.ItemsSource = from developers in profiler.Descendants("status")
select new ItemViewModel
{
Tweet = developers.Element("text").Value,
TweetImage = developers.Element("user").Element("profile_image_url").Value,
TweetSender = developers.Element("user").Element("screen_name").Value,
};
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString() + "\nThis may caused by your IP has made over 150 request in less than 1 hour. Try checking back in the next hour or try restarting your phone.");
return;
}
でそれを置いたが、それは詳細ページに移動するとき、それは例外にtruned。 WebClientのダウンロード完了イベントハンドラのMainViewModelクラスにそのコードを配置します。このようにしてXML解析を行うためにはどの行を編集すればよいのですか?しかし、MainViewModelではどの行を編集すればよいですか?どんな答えでも分かるでしょう
ありがとうございます。
私はファイルを作成しました。今、私は何を編集すべきですか? – user1072976
この行で何を変更する必要がありますか? listBox2.ItemsSource = profiler.Descendants( "status") – user1072976
の開発者から、List ParsedList ..を与える必要があるlistBox2.ItemsSourceではなく、この解析リストをurにバインドする必要がありますUI –