Return the count of an NSMutableArray from an XML id number in Objective-C?

DeneDakyliele

New Member
I am building an NSMutableArray out of an XML file and need to return the count of each resident id in the XML file. Is it possible to do this?\[code\]<residents><resident id="1"> <name> <first>Daffy</first> <last>Duck</last> </name></resident><resident id="2"> <name> <first>Mickey</first> <last>Mouse</last> </name></resident>\[/code\]etc...I will be returning the count using code similar to this:\[code\]- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {NSLog(@"Count = %i", [appDelegate.residents count]);return [appDelegate.residents count];\[/code\]Any suggestions?For the array, in my AppDelegate.h I have:\[code\] @interface AppDelegate : UIResponder <UIApplicationDelegate>{ UIWindow *window; UINavigationController *navigationController; NSMutableArray *residents; }@property (strong, nonatomic) UIWindow *window;@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;@property (nonatomic, retain) NSMutableArray *residents;\[/code\]In XMLAppDelegate.h I use:\[code\] @interface XMLAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; UINavigationController *navigationController; NSMutableArray *residents;}@property (nonatomic, retain) IBOutlet UIWindow *window;@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;@property (nonatomic, retain) NSMutableArray *residents;@end\[/code\]
 
Back
Top