如何解析Objective C中的HTML

时间:2022-10-29 20:56:52

Any body could help me please! I want to parse some HTML code from web for Objective C, the HTML codes are like bellow:

任何身体都可以帮助我!我想从Web上为Objective C解析一些HTML代码,HTML代码如下:

<div class="linkSummary">
<a href="video_page.php?id=2309"><img class="video_thumbnail" width="120" height="90" src="video_thumbnails/vthumb_2309.jpg"></a>


<div class="video_title"><a href="video_page.php?id=2309">المپیک لندن؛ اهداء مدال کشتی فرنگی ۵۵ کیلوگرم </a></div>
<div class="video_league"><a href="videos.php?cupID=23">المپیک لندن</a></div>
<div class="video_date">&#1777;&#1781; &#1605;&#1585;&#1583;&#1575;&#1583; &#1777;&#1779;&#1785;&#1777; (<span dir="ltr">5 August 2012</span>)</div>
<div class="send_details">
    <span class="icon_holder"><img width="22" height="25" class="rollover v1" src="image_slices/icon_ball_off.jpg" hover="image_slices/icon_ball_on.jpg" vid="1" otid="4" oid="2309"><img width="22" height="25" class="rollover v2" src="image_slices/icon_yellow_off.jpg" hover="image_slices/icon_yellow_on.jpg" vid="2" otid="4" oid="2309"><img width="22" height="25" class="rollover v3" src="image_slices/icon_red_off.jpg" hover="image_slices/icon_red_on.jpg" vid="3" otid="4" oid="2309"></span>&#1578;&#1575; &#1575;&#1604;&#1575;&#1606; &#1777;&#1780; &#1606;&#1592;&#1585; &#1583;&#1585; &#1605;&#1608;&#1585;&#1583; &#1575;&#1740;&#1606; &#1608;&#1740;&#1583;&#1740;&#1608; &#1583;&#1575;&#1583;&#1607; &#1588;&#1583;&#1607; &#1575;&#1587;&#1578;. | <a href="video_page.php?id=2309">&#1606;&#1592;&#1585; &#1588;&#1605;&#1575; &#1670;&#1740;&#1607;&#1567;</a>
</div>

</div>

I want parser to parse video_title and the image that associated to that title, and put these into a table. Anybody could show me some sample code to do this?

我希望解析器解析video_title和与该标题关联的图像,并将它们放入表中。有人可以给我看一些示例代码吗?

1 个解决方案

#1


1  

Depending on what you're trying to do, you may find that ElementParser works for you. It provides some very useful methods for getting data out of an HTML document using CSS selectors, similar to jQuery. The documentation is a little light, but an intro to using it is available.

根据您的尝试,您可能会发现ElementParser适合您。它提供了一些非常有用的方法,使用类似于jQuery的CSS选择器从HTML文档中获取数据。文档有点轻松,但可以使用它的介绍。

#1


1  

Depending on what you're trying to do, you may find that ElementParser works for you. It provides some very useful methods for getting data out of an HTML document using CSS selectors, similar to jQuery. The documentation is a little light, but an intro to using it is available.

根据您的尝试,您可能会发现ElementParser适合您。它提供了一些非常有用的方法,使用类似于jQuery的CSS选择器从HTML文档中获取数据。文档有点轻松,但可以使用它的介绍。