ios - hpple: is it possible to get text value like javascript textContent -


is possible text content of child elements recursively in hpple. method in tfhppleelement class? such javascript

document.getelementbyid("testdiv").textcontent 

i'm using code content of news title

nsurl *newurl = [nsurl urlwithstring:@"http://somesite"];         nsdata *newsdata = [nsdata datawithcontentsofurl: newurl];          tfhpple *newsparser = [tfhpple hpplewithhtmldata: newsdata];          nsstring *newsxpathquerystring = @"//div[@class='item column-1']";         nsarray *newsnodes = [newsparser searchwithxpathquery: newsxpathquerystring];          nsmutablearray *newnews = [[nsmutablearray alloc] initwithcapacity: 0];          (tfhppleelement *element in newsnodes)         {             news *news = [[news alloc] init];              [newnews addobject: news];              news.title = [[element content] stringbytrimmingcharactersinset:[nscharacterset whitespaceandnewlinecharacterset]];              news.photo_url = [element objectforkey:@"src"];              _allnews = newnews;             [self.tableview reloaddata];         }     } 

you can use

news.title = [[element firstchild]content] children elements content 

Popular posts from this blog