Reputation: 429
I am reading an data from an XML file for my iPhone application. This data contains html tags such as <p></p> <strong> <B>
, etc in it. By using NSString class can i remove these tags and format the display of the text as needed.
For example, if text inside the <p> </p>
i want to display it in next paragraph. Is it possible?
Please suggest.
Any help would be appreciated.
-Sathiya
Upvotes: 0
Views: 729
Reputation: 75058
Why not leave the formatting in place, and use either a UIWebView to display the text or a TTStyledTextLabel
from the Three20 project.
Upvotes: 1
Reputation: 576
There is a library on the iPhone to do HTML parsing, but it takes a bit more work than using NSString. However, it will give you a lot more control. You can walk the HTML tree and pick out the parts that interest you.
Look at libxml2's html reader:
http://xmlsoft.org/html/libxml-HTMLparser.html#htmlReadMemory
Upvotes: 0
Reputation: 10860
Mmm... Only me doesn't see an example? But you can insert @"\n" to move text to the next line in your UITextView or console.
Upvotes: 0