I'm new to objective c and iPhone programming. I can't seem to figure out why no cells will fill when I run this code. The xml content displays in the console log and xcode displays no errors. Can any help?
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{
if(![elementName compare:@"Goal"] )
{
tempElement = [[xmlGoal alloc] init];
}
else if(![elementName compare:@"Title"])
{
currentAttribute = [NSMutableString string];
}
else if(![elementName compare:@"Progress"])
{
currentAttribute = [NSMutableString string];
}
}
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
if(![elementName compare:@"Goal"])
{
[xmlElementObjects addObject:tempElement];
}
else if(![elementName compare:@"Title"])
{
NSLog(@"The Title of this event is %@", currentAttribute);
[tempElement setTitled:currentAttribute];
}
else if(![elementName compare:@"Progress"])
{
NSLog(@"The Progress of this event is %@", currentAttribute);
[tempElement setProgressed:currentAttribute];
}
}
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
if(self.currentAttribute)
{
[self.currentAttribute appendString:string];
}
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [xmlElementObjects count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [mtableview dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
// Set up the cell...
cell.textLabel.text = [xmlElementObjects objectAtIndex:indexPath.row];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
}