-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSLog(@"3 DONE. Received Bytes: %d", [getMagaListsWebData length]);
NSString *recievedXML = [[NSString alloc]initWithData:getMagaListsWebData encoding:NSUTF8StringEncoding];
[recievedXML release];
//重新加載xmlParser
if(getMagaListsXmlParser){
[getMagaListsXmlParser release];
getMagaListsXmlParser = nil;
}
getMagaListsXmlParser = [[NSXMLParser alloc]initWithData:getMagaListsWebData];
[getMagaListsXmlParser setDelegate: self];
[getMagaListsXmlParser setShouldResolveExternalEntities: YES];
[getMagaListsXmlParser parse];
if (![getMagaListsXmlParser parse]) {
NSLog(@"parse error = %@", [getMagaListsXmlParser parserError]);
//theConnection = [[NSURLConnection alloc] initWithRequest:getMagaListsRequest delegate:self startImmediately:YES];
}
}
我收到了错误消息:
parse error = Error Domain=NSXMLParserErrorDomain
Code=5 "The operation couldn’t be completed. (NSXMLParserErrorDomain error 5.)"
答案 0 :(得分:2)
一个非常有用的技巧是突出显示有问题的错误/域
NSXMLParser.h, NSXMLParserPrematureDocumentEndError = 5,
看起来您的入站文档存在问题,可能是某处的不平衡块。