많은 테이블이있는 HTML 페이지를 구문 분석하려고합니다. 나는 Objective C로 HTML을 파싱하는 방법에 대해 그물을 조사했고 hipple을 발견했다. news forumHTML로 테이블을 구문 분석하려면 어떻게해야합니까?
I :이 튜토리얼로 http://www.raywenderlich.com/14172/how-to-parse-html-on-ios
은이 사이트 (히브리어)에서 테이블을 많이 가지고 일부 포럼 뉴스를 분석하려고 : 나는 나를 인도하는 자습서를 찾을 것 뉴스 제목을 파싱하려고했지만 코드에 무엇을 써야할지 모르겠다. 내가 얻을 수있는 길에 도달하려고 할 때마다 "노드는 무효"했습니다. 내 최신 시도의
코드는 다음과 같습니다
NSURL *contributorsUrl = [NSURL URLWithString:@"http://rotter.net/cgi-bin/listforum.pl"];
NSData *contributorsHtmlData = [NSData dataWithContentsOfURL:contributorsUrl];
// 2
TFHpple *contributorsParser = [TFHpple hppleWithHTMLData:contributorsHtmlData];
// 3
NSString *contributorsXpathQueryString = @"//body/div/center/center/table[@cellspacing=0]/tbody/tr/td/table[@cellspacing=1]/tbody/tr[@bgcolor='#FDFDFD']/td[@align='right']/font[@class='text15bn']/font[@face='Arial']/a/b";
NSArray *contributorsNodes = [contributorsParser searchWithXPathQuery:contributorsXpathQueryString];
// 4
NSMutableArray *newContributors = [[NSMutableArray alloc] initWithCapacity:0];
for (TFHppleElement *element in contributorsNodes) {
// 5
Contributor *contributor = [[Contributor alloc] init];
[newContributors addObject:contributor];
// 6
누군가가 타이틀을 얻기에 이르기까지 나를 안내 수 있을까요?