I have a problem with "Hpple". I'm parse html file, and I want to get the entire table, but the result I get (null)
My code in Objective-C:
-(void)loadTutorials {
// 1
paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
filePath = [NSString stringWithFormat:@"%@/%@", [paths objectAtIndex:0],@"index.html"];
NSData *data = [NSData dataWithContentsOfFile:filePath];
// 2
TFHpple * doc = [[TFHpple alloc] initWithHTMLData:data];
// 3
NSString *tutorialsXpathQueryString = @"/html/body/div/table/tr/td[@class='bottomwideborder']"; //Next comes the big table
NSArray *tutorialsNodes = [doc searchWithXPathQuery:tutorialsXpathQueryString];
for (TFHppleElement *element in tutorialsNodes) {
table = [element text];
}
}
- (void)viewDidLoad
{
[super viewDidLoad];
[self loadTutorials];
html = [NSString stringWithFormat:@"<html><body>%@</body></html>", table];
[Web loadHTMLString:html baseURL:nil];
}
Table that I want to parse too get is a long and I think that it's too big for NSString or NSArray
What can I do to fix this?