Hey guys, has any of you some experience with parsing HTML with the TouchXML lib on the iPhone. I would like to parse some html and therefore try to do the following
self.parser = [[CXMLDocument alloc]initWithData:self.html options:0 error:&error1];
if (error1) {
NSLog(@"Error: %d", error1);
}
NSError *error;
NSArray *resultNodes = [[NSArray alloc]init];
NSLog(@"starting to do some crazy parsing");
resultNodes = [self.parser nodesForXPath:@"//div" error:&error];
if (error)
NSLog(@"initWithData error : %d", error);
Unfortunately that does not work at all. And I dont know how to debug this properly. My HTML should be valid. It simply starts with a html tag, meaning there is no doctype. The initWithData method already seems to crash and returns the following error: Error: Error Domain=CXMLErrorDomain Code=-1 "The operation couldn’t be completed. (CXMLErrorDomain error -1.)" If I try to output the second error the app crashes before, probably cause of the fact that initWithData does not work.
Has anyone of you made some experience with parsing HTML with the TouchXML lib?
Thanks for any help!