I am developing an app which reads data from SharePoint list into an array. I am at the point of displaying this data on screen as text fields. However one of the imported data fields is formatted in html markup code e.g.
<div class="ExternalClass7E8EC81DFF944C7BB81DA896086ABDFF"><p> </p> <div><span style="font-size:12pt"><font face="Calibri">Project Completion Date (A05-A07) <span> </span><span> </span>15<sup>th</sup> May 2012</font></span></div> <p> </p></div>
Does anyone know how I could go about extracting the text content from this? Alternatively perhaps I should be looking at displaying this data as a web page on screen? If so could someone point me in the right direction please?
Many thanks in advance for your help…
The HTML as posted is encoded with “entity” codes. So, the first task is to decode those to get back to actual HTML. You can use
CFXMLCreateStringByUnescapingEntities()for that.You can create an NSXMLDocument from the result with the NSXMLDocumentTidyHTML option. You can request the
-stringValueof that to get the plain text.Alternatively, you can create an NSAttributedString with
-initWithHTML:documentAttributes:.