I am newbie to Iphone Application development. Please help me. I am sorry if I am wrong. I have following declarations:
//.h file:
NSMutableArray *dataArray;
NSMutableDictionary *item;
//.m file
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{
currentElement = [elementName copy];
if ([elementName isEqualToString:@"table"]){
item = [[NSMutableDictionary alloc] init];
currentEid = [[NSMutableString alloc] init];
currentEname = [[NSMutableString alloc] init];
currentEurl = [[NSMutableString alloc] init];
}
//NSLog(@"didStartElement");
}
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{
if ([elementName isEqualToString:@"table"]) {
// save values to an item, then store that item into the array...
[item setObject:currentEname forKey:@"ename"];
//NSLog(@"%@",item);
[self.dataArray addObject:[item copy]];
NSLog(@"%@",dataArray);
}
}
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{
if ([currentElement isEqualToString:@"eid"]) {
[currentEid appendString:string];
} else if ([currentElement isEqualToString:@"ename"]) {
[currentEname appendString:string];
//NSLog(@"%@",currentEname);
} else if ([currentElement isEqualToString:@"eurl"]) {
[currentEurl appendString:string];
}
// NSLog(@"foundCharacters");
}
I get null values for the NSMutableArray(dataArray) when displayed. How to solve it? Or else tell me the way to display the NSMutableDicitonary data in table view cells.
Thanks in Advance.. :)