Let's say I have the following string:
NSString * str = "<a href="http://www.google.com"style="">
</br>
<a href="http://www.google.com" id="" style="">Come on</a>hello world"
How can I parse out the value of the anchor tag--"Come on"?
Should I use HTMLNode.h and HTMLParser.h开发者_开发技巧? Examples would be appreciated.
If it is static, then you can use string manipulation to take out the substring out of the tag
OR
If it is dynamic and html/xml code keeps changing then you can use NSXMLParser. Keep in mind that NSXMLParser should more preferably used only when data is in XML format.
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSXMLParser_Class/Reference/Reference.html
Hope this helps.
精彩评论