0

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?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
IlyaKharlamov
  • 479
  • 1
  • 4
  • 10
  • What do you mean by that it's too long for an NSString or an NSArray? Would it pinch the array or what? –  Nov 08 '12 at 20:26
  • Mmmm, very big... I want get some table from html file, and past it to UiWebView, but I the result I get (null)! Why??? – IlyaKharlamov Nov 09 '12 at 03:27

0 Answers0