html - Hpple, getting text after </span> -


so think last hpple question! have found entry in html doc parsing hpple. have tried many different queries, no luck. here sample of html.html

i can text staring "today's project" //div[@class = 'entry-content']/p. can next tag //div[@class = 'entry-content']//a[@title]//* along text after it. however, can see there still text after "/span". however, nothing have tried work. have tried looking @ children of element, tried //div[@class = 'entry-content']/p//text(), //div[@class = 'entry-content']/p//following::*, nothing works. if has ideas, ears!!! again of time.

edit #1 try different things looking @ html. under p tag text need, "today's project..." there span changing text color , including link, followed more text. need jump on span continue reading text. maybe question should be, how jump on span? looking.

edit #2 well, going start bounty on one. need help. have looked everywhere , have tried ton of different things. nothing working me. can not text after 1 closed span. , format appears often. author of blog parsing app changes style of words , can not text after changes style. appreciated. again looking.

edit #3 here screen shot of dom tree html. if can notice parsing div class "entry content" text in question exposed. starts "today..." span change color of text, can text. text after that, need, " one....." right before close p tag.

dom tree

i placed entire html on gist. here. line in question 102. although html did not copy nicely. thanks.

make changes in code further on hierarchy , worked on html sample. note: i'm appending entry-content in single nsmutablestring make easier. like warned in comment, use caution. :-)

nsstring *filepath = [[nsbundle mainbundle] pathforresource:@"test" oftype:@"html"];  nsdata *data = [nsdata datawithcontentsoffile:filepath]; tfhpple *detailparser = [tfhpple hpplewithhtmldata:data]; nsstring *xpathquerystring = @"//div[@class='entry-content']"; nsarray *node = [detailparser searchwithxpathquery:xpathquerystring];  nsmutablestring *test = [[nsmutablestring alloc] initwithstring:@""];  (tfhppleelement *element in node) {     (tfhppleelement *child in element.children) {                     if (child.content != nil) {             [test appendstring:child.content];         }         if ([child.children count]!= 0) {             (tfhppleelement *grandchild in child.children) {                 if (grandchild.content != nil) {                     [test appendstring:grandchild.content];                  }                 (tfhppleelement *greatgrandchild in grandchild.children) {                     if (greatgrandchild.content != nil) {                         [test appendstring:greatgrandchild.content];                     }                     (tfhppleelement *greatgreatgrandchild in greatgrandchild.children) {                         if (greatgreatgrandchild.text != nil) {                             [test appendstring:greatgreatgrandchild.text];                         }                         if (greatgreatgrandchild.content != nil) {                             [test appendstring:greatgreatgrandchild.content];                         }                     }                 }             }         }     } }  nslog(@"test = %@", test); 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -