-2

Possible Duplicate:
Parsing XML data to NSMutableArray iOS - iPhone

<ForecastResult>
<Forecast>
<Date>2012-06-27T00:00:00</Date>
<WeatherID>4</WeatherID>
<Desciption>Sunny</Desciption>
<Temperatures>
<MorningLow/>
<DaytimeHigh>100</DaytimeHigh>
</Temperatures>
<ProbabilityOfPrecipiation>
<Nighttime/>
<Daytime>00</Daytime>
</ProbabilityOfPrecipiation>
</Forecast>
<Forecast>
<Date>2012-06-28T00:00:00</Date>
<WeatherID>4</WeatherID>
<Desciption>Sunny</Desciption>
<Temperatures>
<MorningLow>74</MorningLow>
<DaytimeHigh>95</DaytimeHigh>
</Temperatures>
<ProbabilityOfPrecipiation>
<Nighttime>10</Nighttime>
<Daytime>00</Daytime>
</ProbabilityOfPrecipiation>
</Forecast>

The above is my XML file and i want to read Date and DaytimeHigh into NSMuttableArray. I am using NSXML parser .

4
  • I saw that question but could not understand. the element names are not clear categlist is not found in that XML file can u clarify which categlist is what in that post Commented Jun 27, 2012 at 20:25
  • In that post, categList is an NSMutableArray. The OP in that question wants to parse XML data into categList. Commented Jun 27, 2012 at 20:29
  • what does categList "if ( [elementName isEqualToString:@"categList"])" Commented Jun 27, 2012 at 20:34
  • Is a Muttable array one that you can put dogs into? Commented Jun 27, 2012 at 20:44

1 Answer 1

0

You were asking about categList in the question I said was a duplicate. You shouldn't focus on the question, but rather the answer. The answer in that question suggests that you use XMLReader, which allows for easy XML parsing into NSDictionary objects. Then you could pass the dictionary objects into an NSArray. For detailed instructions on how to use XMLReader, go to the linked page above. Here's how you would pass the NSDictionary values n an NSMutableArray:

NSMutableArray *arrayFromDictionary = [dictionaryWithXMLData allValues];

Hope this helps!

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.