我无法使用NSXMLParser获取值

时间:2012-11-14 13:51:23

标签: iphone objective-c ios ios4 nsxmlparser

我尝试了很多方法来获取NSXMLParser的值,但是我没有成功。 attributeDict objectForKey对我不起作用。

这是我的代码:

    - (void) parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
 { 
  if (![elementName isEqual:@"item"])
    return;

CerereIndemnizatieDoc *cerereIndemnizatie  = [[CerereIndemnizatieDoc alloc] init];
NSString * index = [attributeDict objectForKey:@"id"];
NSString * name = [attributeDict objectForKey:@"nume"];
cerereIndemnizatie.id = index;
cerereIndemnizatie.nume = name;

if (!cereriIndemnizatie)
    cereriIndemnizatie = [[NSMutableArray alloc] init];

[cereriIndemnizatie addObject:cerereIndemnizatie];

}

0 个答案:

没有答案