NSXMLParser的parse

Posted on 2009年8月16日 06:06

我把一个bin文件mv到/tmp/fake.xml,然后试试看NSXMLParser的parse判断there is an error or if the parsing operation is aborted的能力

- (void)parseXMLFile {
    BOOL ret;
    NSURL *xmlURL = [NSURL fileURLWithPath:@"/tmp/fake.xml"];
    NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:xmlURL];
   
    ret = [xmlParser parse];
    if (ret == FALSE) {
        NSLog(@"there is an error or if the parsing operation is aborted!");
        return ;
    }
}