XML : iOS: using kissxml to parse html failed

I use kissxml to parse a webpage. But when I create a NSXMLDocument object, I fail.

  + (NSXMLDocument*)createXMLDocumentFromString:(NSString *)file {      NSXMLDocument *xmlDoc;      NSError *err=nil;        xmlDoc = [[NSXMLDocument alloc] initWithXMLString:file                                                options:1 << 9                                                  error:&err];      if (err) {          NSLog(@"createXMLDocumentFromString error:%@",err);      }        return xmlDoc;  }    

Xcode log:

  createXMLDocumentFromString error:Error Domain=DDXMLErrorDomain Code=1 "The operation couldn’t be completed. (DDXMLErrorDomain error 1.)"    

I'm sure I get the full source code from webpage. Later I use local html file and delete <!DOCTYPE html> and try again, but I still get the same error log.

No comments:

Post a Comment