开发者

Exception while parsing

When I build my code I unable to get the data in array!

code:

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName 
  namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName 
    attributes:(NSDictionary *)attributeDict {

if([elementName isEqualToString:@"catname"]) 
    appDelegate.books = [[NSMutableArray alloc] init];

else if([elementName isEqualToString:@"subcatname"]) 
           {
        aBook = [[Book alloc] init];
           }        
}

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {

if(!currentElementValue) 
    currentElementValue = [[NSMutableString al开发者_如何学运维loc] initWithString:string];
else
  [currentElementValue appendString:string];

} - (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 
{
[aBook setValue:currentElementValue forKey:elementName];
  }
[currentElementValue release];
currentElementValue = nil;

}

gdb:

011-03-30 16:19:16.661 XML[5671:20b] aBook.Catname.....(null) 2011-03-30 16:19:16.661 XML[5671:20b] Processing Element: iid 2011-03-30 16:19:16.661 XML[5671:20b] Processing Value: 5 2011-03-30 16:19:16.662 XML[5671:20b] aBook.Catname.....(null) 2011-03-30 16:19:16.662 XML[5671:20b] Processing Element: subcatname 2011-03-30 16:19:16.662 XML[5671:20b] Processing Value: card5 2011-03-30 16:19:16.663 XML[5671:20b] aBook.Catname.....(null) 2011-03-30 16:19:16.663 XML[5671:20b] Processing Element: url 2011-03-30 16:19:16.663 XML[5671:20b] Processing Value: http://www.orkutgroup.com/scraps/new-year-2.jpg 2011-03-30 16:19:16.664 XML[5671:20b] aBook.Catname.....(null) 2011-03-30 16:19:16.664 XML[5671:20b] aBook..... 2011-03-30 16:19:16.665 XML[5671:20b] appDelegate.books.....( ) 2011-03-30 16:19:16.665 XML[5671:20b] aBook.Catname.....(null)

What could be the possible reason for this? Help!


u were not added iid ivar in Book class please verify

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜