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 6167475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:31:10+00:00 2026-05-23T22:31:10+00:00

I did appreciate your help for my previous question , and i was wondering

  • 0

I did appreciate your help for my previous question , and i was wondering how to read data from an URI,using web service(let’s assume it’s the same data).
Here’s the url link:
http://www.google.com/ig/api?weather=paris
I tryied with this code but it didn’t work:

 public MainPage()
        {
        InitializeComponent();

        WebClient wc = new WebClient();
        wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(download_string_complete);
        wc.DownloadStringAsync(new Uri("http://www.google.com/ig/api?weather=hammamet", UriKind.Absolute));
        }

    public void download_string_complete(object sender, DownloadStringCompletedEventArgs e)
        {


       if (e.Error == null)
            {
            ListBoxItem areaItem = null;
            StringReader stream = new StringReader(e.Result);
            XmlReader reader = XmlReader.Create(stream);

            string day = String.Empty;
            string low = String.Empty;
            string high = String.Empty;
            string condition = String.Empty;

            while (reader.Read())
                {
                if (reader.NodeType == XmlNodeType.Element)
                    {
                    if (reader.Name=="forecast_conditions")
                        {
                    WeatherElement welement = new WeatherElement();
                    switch (reader.Name)
                        {
                        case ("day_of_week"):
                                {
                                day = reader.ReadElementContentAsString();
                                areaItem = new ListBoxItem();
                                areaItem.Content = day;
                                friendsBox.Items.Add(day);
                                } break;

                        case ("low"):
                                {
                                low = reader.ReadElementContentAsString();
                                areaItem = new ListBoxItem();
                                areaItem.Content = low;
                                friendsBox.Items.Add(low);
                                } break;

                        case ("high"):
                                {
                                high = reader.ReadElementContentAsString();
                                areaItem = new ListBoxItem();
                                areaItem.Content = high;
                                friendsBox.Items.Add(high);
                                } break;

                        case ("condition"):
                                {
                                condition = reader.ReadElementContentAsString();
                                areaItem = new ListBoxItem();
                                areaItem.Content = condition;
                                friendsBox.Items.Add(condition);
                                } break;
                        }

                    }
                }
            }
        }
    }
  • 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-23T22:31:11+00:00Added an answer on May 23, 2026 at 10:31 pm
      void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                StringReader stream = new StringReader(e.Result);
                XmlReader reader = XmlReader.Create(stream);
    
                string Day = String.Empty;
                string Low = String.Empty;
                string High = String.Empty;
                string ImageUri = String.Empty;
                string Condition = String.Empty;
    
                reader.MoveToContent();
    
                while (reader.Read())
                {
                    switch (reader.Name)
                    {
                        case ("day_of_week"):
                            {
                                listBox1.Items.Add(new ListBoxItem()
                                  {
                                      Content = reader.GetAttribute("data")
                                  });
                                Day = Content.ToString();
                            } break;
                        case ("low"):
                            {
                                listBox1.Items.Add(new ListBoxItem()
                                {
                                    Content = reader.GetAttribute("data")
                                });
                                Low = Content.ToString();
                            } break;
                        case ("high"):
                            {
                                listBox1.Items.Add(new ListBoxItem()
                                {
                                    Content = reader.GetAttribute("data")
                                });
                                High = Content.ToString();
                            } break;
                        case ("icon"):
                            {
                                listBox1.Items.Add(new ListBoxItem()
                                {
                                    Content =  reader.GetAttribute("data")
                                });
                                Image wkpinImage = new Image();
                                wkpinImage.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("http://www.google.com" + Content, UriKind.Absolute));
                                wkpinImage.Opacity = 0.8;
                                wkpinImage.Stretch = System.Windows.Media.Stretch.None;
                            } break;
    
                        case ("condition"):
                            {
                                listBox1.Items.Add(new ListBoxItem()
                                {
                                    Content = reader.GetAttribute("data")
                                });
                                Condition = Content.ToString();
                            } break;
                        case("weather"):
                        break;  
                    }
                }
            reader.Close(); 
                }
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm re-creating a registration for my website using Codeigniter. On my previous page, I
I am trying to to read each line from a text file and put
I just started to develop web. I am currently stuck in a question not
I'm using Python 2.6.2 [GCC 4.3.3] running on Ubuntu 9.04. I need to read
I am completely lost at the moment and would greatly appreciate your assistance. I
I am taking over some applications from a previous developer. When I run the
I have this data set made using write.zoo for which I used the following
Did you used Dynamic websites before? you see its a good way for making
Did some searches here & on the 'net and haven't found a good answer
Did you ever have the following situation: you need to store information, but a

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.