- (void)fetchOneHtmlwithUrl:(NSURL *)url withCode:(NSString *)code withValueIn:(double)valueIn withMoneyIn:(double)moneyIn { NSError *error; NSData *dataGB2312 = [[NSData alloc] initWithContentsOfURL:url options:NSDataReadingMappedIfSafe error:&error]; NSStringEncoding gb2312Encoding =CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000); NSString *htmlGB2312 = [[NSString alloc] initWithData:dataGB2312 encoding:gb2312Encoding]; NSString *utf8HtmlStr = [htmlGB2312 stringByReplacingOccurrencesOfString:@"charset=gb2312" withString:@"charset=utf-8"]; NSData *dataUTF8 = [utf8HtmlStr dataUsingEncoding:NSUTF8StringEncoding]; ParseResultBean *bean = [ParseResultBean alloc]; TFHpple *xpathParser = [[TFHpple alloc] initWithHTMLData:dataUTF8]; NSArray *eArrayCode = [xpathParser searchWithXPathQuery:@"/html/body/div[1]/div[7]/div[2]/div[1]/div[1]/div[1]/span[2]"]; TFHppleElement *eCode = [eArrayCode objectAtIndex:0]; bean->code = [[eCode attributes] objectForKey:@"title"]; [allRows addObject:bean]; }