I want to extract the body paragraphs from a web page and store them into a string.
First, I obtain the entire source code using
NSString *sourceCode = [NSString stringWithContentsOfURL:[NSURL URLWithString:currentLink] encoding:NSUTF8StringEncoding error:&error];
The body paragraphs begin after <!-- (START) Pagination Content Wrapper -->
and ends before <!-- (END) Pagination Content Wrapper -->
so I plan to split the string like so
NSString *startingPt = @"<!-- (START) Pagination Content Wrapper -->";
NSString *endingPt = @"<!-- (END) Pagination Content Wrapper -->";
NSString *sub = [sourceCode substringFromIndex:NSMaxRange([str rangeOfString:startingPt])];
sub = [sourceCode substringToIndex:[s rangeOfString:endingPt].location;
Then I would use stringByReplacingOccurrencesOfString:withString:
to replace the remaining html tags with @""
Is there a better way to achieve my goal?