开发者

problem in parsing!

开发者 https://www.devze.com 2023-02-20 07:35 出处:网络
i m not able to get processing values beyond \"iid\". giving exception: [ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key iid.\'

i m not able to get processing values beyond "iid". giving exception:

[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key iid.'

problem in parsing!

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName 
  namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName 
    attributes:(NSDictionary *)attributeDict {
    if([elementName isEqualToString:@"NewDataSet"]) 
    {
    appDelegate.books = [[NSMutableArray alloc] init];
        }
    else if([elementName isEqualToString:@"Table"])
      {
       if([elementName isEqualToString:@"id"])
             { 
          {
        aBook = [[Book alloc] init];
         }
     }
    NSLog(@"Processing Element: %@", elementName);
}

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string { 
   开发者_StackOverflow中文版    if(!currentElementValue) 
        currentElementValue = [[NSMutableString alloc] initWithString:string];
    else
    {
    [currentElementValue appendString:string];
    NSLog(@"Processing Value: %@", currentElementValue);
    }
}

- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName 
  namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
    //if([elementName isEqualToString:@"Tablesreturn"])
        //return;
        if([elementName isEqualToString:@"Table"]) 
         {
        [appDelegate.books addObject:aBook];
        [aBook release];
        aBook = nil;
     }
    else 
        [aBook setValue:currentElementValue forKey:elementName];
    [currentElementValue release];
    currentElementValue = nil;
}


It's not finding the iid value. It's case sensitive, so check if you're using the wrong case in your label name.

If you're not looking for too many values maybe you can just do a manual if then else for all the xml nodes you're interested in.

something like -

- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName 
  namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
    if([elementName isEqualToString:@"Table"]) 
    {
         [appDelegate.books addObject:aBook];
         [aBook release];
         aBook = nil;
    }
    else if([elementName isEqualToString:@"xyz"])
    {
        [aBook setValue:currentElementValue forKey:@"xyz"];
    }
    // and so on, for the rest of the nodes.
    [currentElementValue release];
    currentElementValue = nil;
}


in ur Book class verify all tags or fields specified in .h file.......reply me

like Table, Tablesreturn.......all of them.

and synthesize all of them

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号