我NSXMLParser
使用以下代码创建了对象:
- (void) foo:(NSMutableString *)string
{
NSXMLParser *parser = [[NSXMLParser alloc] initWithData:[string dataUsingEncoding:NSUTF8StringEncoding]];
[parser setDelegate:self];
[parser parse];
}
有时我在运行解析器后会出错(错误时调用委托方法):
- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError
{
LOGE(@"XML parser error in line:%ld column:%ld. Retrying..", [parser lineNumber], [parser columnNumber]);
[parser abortParsing];
[parser parse];
}
当我遇到错误时,如何从解析器中提取原始数据string
?data