2
說我有一個無效的XML。出於某種原因,TouchXML仍然認爲它是一個有效的對象。TouchXML - 無效的XML不返回錯誤對象
例如:
NSString *str = @"?> obviously invalid!";
NSData *data = [str dataUsingEncoding:NSASCIIStringEncoding];
NSError *parseError = nil;
CXMLDocument *document = [[[CXMLDocument alloc] initWithData:data encoding:NSASCIIStringEncoding options:0 error:&parseError] autorelease];
NSLog(@"Error %i......%@", [parseError code], [parseError localizedFailureReason]);
NSLog(@"Document ......%@", [document description]);
輸出是:
Error 0......(null)
Document ......<CXMLDocument 0x6f05710 [0x6f274c0]> <?xml version="1.0" encoding="us-ascii"?>
有誰知道爲什麼發生這種情況?我沒有收拾XML ...
謝謝!