I have a working UITable with sections. The UITable gets its data from an external XML file this also works good. But what I want is that the XMLparser excludes the rows where the date is older then today. I thought to do this at the moment where my file adds an element to my array. But when I add this code I get an error. Please help me out on this one!
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
NSDate* date = [NSDate date];
NSDateFormatter* nsformatter = [[[NSDateFormatter alloc] init] autorelease];
[nsformatter setDateFormat:@"yyyy-MM-dd"];
NSDate* stageDate = [XMLParser dateFromString:aStage.end];
if([elementName isEqualToString:@"Stages"])
{
return;
}
if([elementName isEqualToString:@"Month"])
{
[appDelegate.stages addObject:aMonth];
[aMonth release];
aMonth = nil;
}
if([elementName isEqualToString:@"Stage"])
{
/* THIS IS THE PART I ADDED BUT GIVES THE ERROR
if(stageDate < date)
{
*/
[aMonth.stagesPerMonth addObject:aStage];
[aStage release];
aStage = nil;
/*
}
*/
}
else
{
[aStage setValue:currentElementValue forKey:elementName];
[currentElementValue release];
currentElementValue = nil;
}
}