Since you don't have any text inside your tags you can use the parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName attributes:(NSDictionary *)attributeDict method on your delegate. Than you can store the values inside a dictionary or object. If you have multiple subject tags you can use the parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName to change the context of your parser. The official documentation should give you more details on which methods are available.
You could do something like that (incomplete implementation):
/*
* Incomplete implementation just to give some pointers
*/
@implementation MyDelegate
-(void) init {
if((self = [super init])) {
_subjects = [NSMutableArray new];
}
}
-(void) parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName attributes:(NSDictionary *)attributeDict {
if([elementName equalsIgnoreCase:@"subject"]) {
_context = [NSMutableDictionary new];
} else {
[_context setObject:[attributeDict valueForKey:@"mark"] forKey:elementName];
}
}
- (void) parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName {
[_subjects addObject:_context]
[_context release]; _context = nil;
}
@end