iOS: Best way to parse html tags?

2019-09-01 02:55发布

In my JSON app I'm parsing the JSON data well but the issue is some elements are formatted as so:

<b>Welcome!</b>

(to give a very basic example!)

I've checked for a unformatted version but there doesn't appear to be one, so what's my best option for some basic parsing?

Thanks

标签: html ios parsing
1条回答
姐就是有狂的资本
2楼-- · 2019-09-01 03:39

Use this class for XPath http://cocoawithlove.com/2008/10/using-libxml2-for-parsing-and-xpath.html.

You can parse XML and HTML tags in easy way.

NSArray *PerformXMLXPathQuery(NSData *document, NSString *query);
NSArray *PerformHTMLXPathQuery(NSData *document, NSString *query);

enjoy

查看更多
登录 后发表回答