NSXMLParser terminating due to NSUnknownKeyException

7331

New Member
I am having trouble parsing an XML document to my project. I am getting the following error:\[quote\] Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key morph.'\[/quote\]Here is a snippet of my XML document:\[code\]<?xml version="1.0" encoding="utf-8"?><CAS version="2.1" avatar="anna"> <frames count="111" signCount="3"><signStart index="0" gloss="mug" /><frame index="0" isComplete="true" time="0" duration="20" boneCount="74" morphCount="51"> <morph name="aaa" amount="0" /> <morph name="ooo" amount="0" /> <morph name="pout" amount="0" /> <morph name="eee" amount="0" /> <morph name="cgng" amount="0" />\[/code\]Here is my code in my XMLParser.h file:\[code\]#import <Foundation/Foundation.h>@class User;@interface XMLParser : NSObject {// an ad hoc string to hold element valueNSMutableString *currentElementValue;// user objectUser *user;// array of user objectsNSMutableArray *times;NSMutableArray *durations;NSMutableArray *wheres;}@property (nonatomic, retain) User *user;@property (nonatomic, retain) NSMutableArray *times;@property (nonatomic, retain) NSMutableArray *durations;@property (nonatomic, retain) NSMutableArray *wheres;- (XMLParser *) initXMLParser;@end\[/code\]and XMLParser.m\[code\]#import "XMLParser.h"#import "User.h"@implementation XMLParser@synthesize user, times, durations, wheres;- (XMLParser *) initXMLParser {self = [super init];if(self){ // init array of user objects times = [[NSMutableArray alloc] init]; durations = [[NSMutableArray alloc] init];// wheres = [[NSMutableArray alloc] init];}return self;}- (void)parser:(NSXMLParser *)parserdidStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict {if(![elementName isEqual:@"frame"]) return; NSLog(@"user element found
 
Back
Top