Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6822567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:40:44+00:00 2026-05-26T21:40:44+00:00

I have to consume a feed XML (RSS) in my Windows Phone 7 application

  • 0

I have to consume a feed XML (RSS) in my Windows Phone 7 application and display those information in a ListBox.

Following way I tried to read the content in XML feed:

  private void button1_Click(object sender, RoutedEventArgs e)
  {            
          client.DownloadStringAsync(new Uri("http://earthquake.usgs.gov/eqcenter/recenteqsww/catalogs/eqs7day-M2.5.xml"), "usgs");
  }

Can someone please guide me how to proceed to get the XML info and to display them as ListBox items?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:40:44+00:00Added an answer on May 26, 2026 at 9:40 pm

    You have to do two things:

    1. Download the feed XML from the URL you have there
    2. Parse the XML and process the resulting XML document

    The following code shows how to do it:

    (GetFeed does part 1, handleFeed does part 2, button1_Click is the click handler which starts the feed download when the user clicks a button.)

    // this method downloads the feed without blocking the UI;
    // when finished it calls the given action
    public void GetFeed(Action<string> doSomethingWithFeed)
    {
        HttpWebRequest request = HttpWebRequest.CreateHttp("http://earthquake.usgs.gov/eqcenter/recenteqsww/catalogs/eqs7day-M2.5.xml");
        request.BeginGetResponse(
            asyncCallback =>
            {
                string data = null;
    
                using (WebResponse response = request.EndGetResponse(asyncCallback))
                {
                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                    {
                        data = reader.ReadToEnd();
                    }
                }
                Deployment.Current.Dispatcher.BeginInvoke(() => doSomethingWithFeed(data));
            }
            , null);
    }
    
    // this method will be called by GetFeed once the feed has been downloaded
    private void handleFeed(string feedString)
    {
        // build XML DOM from feed string
        XDocument doc = XDocument.Parse(feedString);
    
        // show title of feed in TextBlock
        textBlock1.Text = doc.Element("rss").Element("channel").Element("title").Value;
        // add each feed item to a ListBox
        foreach (var item in doc.Descendants("item"))
        {
            listBox1.Items.Add(item.Element("title").Value);
        }
    
        // continue here...
    }
    
    // user clicks a button -> start feed download
    private void button1_Click(object sender, RoutedEventArgs e)
    {
        GetFeed(handleFeed);
    }
    

    Most error checking is omitted for brevity. Some information about what XML elements to expect has Wikipedia. The code for downloading the XML file is based on this excellent blog post about using HttpWebRequest.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Anyone have an pointers on an easy way to consume a search.twitter.com feed with
I have a wcf serivce I want to consume from a j2me application (blackberry).
I have to consume a .NET hosted web service from a Java application. Interoperability
I have a producer/consumers design in my application which implement Produce/Consume functions on user
I have a website that I need to create an RSS feed for. Is
I have an RSS feed URL, that I can view in any Feed Reader.
I have an ASP.NET application that I need to show a video feed from
I have a C# WPF application that needs to consume data that is exposed
I have a C# desktop application, and I consume a web service without problems
I want to use jQuery to consume an RSS feed, and then create some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.