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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:05:29+00:00 2026-06-15T18:05:29+00:00

I have searched the internet for several days, but I cannot find a consise

  • 0

I have searched the internet for several days, but I cannot find a consise answer. I want to make a simple practice weather app that shows the temperature for a hardcoded zip code.

Here is the XML

<data>
<request>
<type>Zipcode</type>
<query>08003</query>
</request>
<current_condition>
<observation_time>08:29 PM</observation_time>
<temp_C>11</temp_C>
<temp_F>52</temp_F>
<weatherCode>143</weatherCode>
<weatherIconUrl>
<![CDATA[
http://www.worldweatheronline.com/images/wsymbols01_png_64/wsymbol_0006_mist.png
]]>
</weatherIconUrl>
<weatherDesc>
<![CDATA[ Mist ]]>
</weatherDesc>
<windspeedMiles>4</windspeedMiles>
<windspeedKmph>7</windspeedKmph>
<winddirDegree>210</winddirDegree>
<winddir16Point>SSW</winddir16Point>
<precipMM>0.0</precipMM>
<humidity>87</humidity>
<visibility>5</visibility>
<pressure>1013</pressure>
<cloudcover>100</cloudcover>
</current_condition>
<weather>
<date>2012-12-08</date>
<tempMaxC>13</tempMaxC>
<tempMaxF>55</tempMaxF>
<tempMinC>9</tempMinC>
<tempMinF>48</tempMinF>
<windspeedMiles>6</windspeedMiles>
<windspeedKmph>9</windspeedKmph>
<winddirection>W</winddirection>
<winddir16Point>W</winddir16Point>
<winddirDegree>260</winddirDegree>
<weatherCode>122</weatherCode>
<weatherIconUrl>
<![CDATA[
http://www.worldweatheronline.com/images/wsymbols01_png_64/wsymbol_0004_black_low_cloud.png
]]>
</weatherIconUrl>
<weatherDesc>
<![CDATA[ Overcast ]]>
</weatherDesc>
<precipMM>3.1</precipMM>
</weather>
</data>

ALL I want to do is to extract the *temp_F* and store it in a NSString.

  • 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-06-15T18:05:31+00:00Added an answer on June 15, 2026 at 6:05 pm

    Since you already mentioned using NSXMLParser, just go with that. Set your delegate to implement the protocol

     @interface MyClass : NSObject <NSXMLParserDelegate>
    

    Watch for the opening tag of your xml entry (looks to be in this case) with something like

     - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict {
    
          if ( [elementName isEqualToString:@"temp_F"] ) {
               // Set flag and reset string
               self.foundTargetElement = true;
               if ( self.myMutableString ) {
                    self.myMutableString = nil;
                    self.myMutableString = [[NSMutableString alloc] init];
               }
          }
     }
    

    Next implement

     - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
           if ( self.foundTargetElement ) {
                 [self.myMutableString appendString:string];
           }     
     }
    

    and using the same pattern as above, watch for your tag, () and append its value to your string, or do whatever else you want with the data:

     - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
    
          self.foundTargetElement = false;
    
          // Do something with your result, or
          // Wait until entire document has been parsed.
     }
    

    Let me know if that works out for you.

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

Sidebar

Related Questions

I have searched the internet and the perforce help pages, but couldn't find a
I have searched the Internet, but I can't find the info I'm looking for.
I have searched internet and stackoverflow thoroughly, but I haven't found answer to my
I have searched the internet and the Boost serialization docs and I cannot find
I have searched over internet but did not get any specific answer or i
I have searched the internet, but could not find any convincing answers; Are the
I have searched the internet/and posts on here to try and find an answer
I have searched the internet for an answer to what could be causing EXCEPTION_ACCESS_VIOLATION
I have searched far and wide on the Internet but have not found anything
I have searched for a general solution to this but only find answers to

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.