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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:37:04+00:00 2026-06-06T00:37:04+00:00

I have a if-else statement which isn’t quite working as I would want it

  • 0

I have a if-else statement which isn’t quite working as I would want it to. This is the method before the statement which holds the variables:

[self.conditionsLabel setText:weather.weathercondition];
NSLog(@"%@", weather.weathercondition);
condition = weather.weathercondition;

Here is the if-else statement:

if ([weather.weathercondition isEqualToString:@"Clear"]) {
    conditionsImageView.image = [UIImage imageNamed:@"Sun.png"];
}
else {
    conditionsImageView.image = [UIImage imageNamed:@"Partly_Sunny.png"];
}

In my console, the weather.weathercondition comes up as clear, but when it goes through the if-else statement, it always goes to the else and shows the Partly_Sunny.png. I’m testing it right now, and I know that the string is going to be “Clear”. I am getting the data from an XML source and this is how it shows the data if I look at it on the internet :

<weatherDesc>
<![CDATA[ Clear ]]>

Is this the cause? It says the CDATA before Clear, but in the code, it always logs as Clear, without the CDATA and other things. I tried putting the <![CDATA[ Clear ]]> in the isEqualToString:, but the same results came. Any help would be greatly appreciated. I’m new to parsing XML and relatively new to Objective-C, so please excuse any errors (not in the code, but generally). I greatly appreciate the help.

  • 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-06T00:37:05+00:00Added an answer on June 6, 2026 at 12:37 am

    The CDATA is a construct to denote that whatever inside should be treated as plain text (not XML). When XML parser detects it, it will remove the CDATA construct and present the data inside the construct.

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

Sidebar

Related Questions

ill have an if statement if (int1 < int2) {} else {} I want
I have this method (someone else wrote it!) - (CGPDFDocumentRef)getPdf { NSArray *paths =
I have a serious long else if statement which contains some links and some
I have this if statement, which returns the result as a AsQueryable to an
I have written an if...else statement which uses an array myArr and a string
Not having much luck, I have the following if/else statement in Razor which works
I have quite a large IF statement which needs to update another form element
I have a basic conditional statement that has a chaining function. After the else
Is it possible to have a SELECT statement in mySQL with an IF/ELSE clause
I'm programming in C++ and have a method which uses a static variable. The

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.