0
 <div dir="ltr"> TEXT TO EXTRACT </div>

<div dir="ltr"> TEXT &amp; MORE TEXT&quot;TEXT&quot; TEXT</div>

Above are examples of the HTML I wish to extract the text into an NSString, ignoring the div wrapper and any other 'stuff' - Some have <BR> included and some have ISO codes (can't remember exact name for these e.g &amp)

many thanks

Nik

Nik Burns
  • 3,363
  • 2
  • 29
  • 37

2 Answers2

2

Perhaps a stronger solution would be to parse the HTML using a Library.

A link and example in this question.

Simple libxml2 HTML parsing example, using Objective-c, Xcode, and HTMLparser.h

Community
  • 1
  • 1
Craig White
  • 13,492
  • 4
  • 23
  • 36
1

I ended up using this catagory:

https://github.com/mwaterfall/MWFeedParser/blob/master/Classes/NSString+HTML.m

works great.

Nik Burns
  • 3,363
  • 2
  • 29
  • 37