更新时间:2022-02-17 15:37:57
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{
currentKey = nil;
[currentStringValue release];
currentStringValue = nil;
if([elementName isEqualToString:@"Value"]){
//alloc some object to parse value into
} else if([elementName isEqualToString:@"Signature"]){
currentKey = @"Signature";
return;
}
}
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{
if(currentKey){
if(!currentStringValue){
currentStringValue = [[NSMutableString alloc] initWithCapacity:200];
}
[currentStringValue appendString:string];
}
}
-(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{
if([elementName isEqualToString:@"Signature"] && [currentStringValue intValue] == 804){
ivar.signature = [currentStringValue intValue];
return;
}
}
类似的东西.注意我还没有在编译器上真正测试过这段代码,所以这里会有语法错误 &那里.
Something like this. Note I havent really tested this code on compiler so there will be syntax errors here & there.