开发者

Extract image URL from HTML text

In Objective-C what is the best method to extract an image url from HTML text?

I've got a chunk of HTML text which may contain one or more images. I want to be a开发者_运维百科ble to get the src URL of each image.


If you don't mind limiting yourself to iOS 4, you can use the new text checking APIs. The one you want is NSTextCheckingTypeLink and the NSRegularExpression class.


This seems to be answered over here: parsing HTML on the iPhone

The second answer down has a detailed explanation, however you will just have to change the xpath expression to match your image tags.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜