Reputation: 1
-(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];
}
}
I received error message:
parse error = Error Domain=NSXMLParserErrorDomain
Code=5 "The operation couldn’t be completed. (NSXMLParserErrorDomain error 5.)"
Upvotes: 0
Views: 1922
Reputation: 17378
A really useful trick is to Spotlight the offending error/domain
NSXMLParser.h, NSXMLParserPrematureDocumentEndError = 5,
Seems you have a problem with your inbound doc, probably an unbalanced block somewhere.
Upvotes: 2