Thursday, February 09, 2012

WP7: XML reading from RSS

WebClient client = new WebClient();
client.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted);
client.OpenReadAsync(new Uri("http://www.todayonline.com/RSS/Todayonline", UriKind.Absolute));

void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
    XmlReader reader = XmlReader.Create(e.Result);
    reader.ReadToFollowing("title");
    // assume there is a textbox named "textBox1"
    textBox1.Text = reader.ReadElementContentAsString() + "\n\n";
}

1 comment:

flash to html5 converter said...

Thanks for sharing your info. I really appreciate your efforts and I will be waiting for your further write ups thanks once again.