解析html

iOS

妖精的绣舞 提交于 2019-12-06 15:23:55
使用TFHpple解析html https://github.com/topfunky/hpple 前期准备工作 引入静态库文件 添加库文件的 header search paths(注意,必须选中 All) 将从github上下载的源码包拖入工程当中 准备工作结束 使用详情 我们来解析网址 http://www.cnblogs.com/YouXianMing/ 中的title标签哦. 思路是这样子的: 1. 将网页转换成NSData 2. 按照标签值在NSData中数据进行查询 3. 检索出想要的数据 打印信息如下: 2014-05-16 11:34:19.227 Html[3736:60b] <title>游贤明 - 博客园</title> 2014-05-16 11:34:19.230 Html[3736:60b] 游贤明 - 博客园 我们来解析复杂点的,如将网页中所有的摘要信息解析出来. 打印信息: 2014-05-16 11:39:24.113 Html[3753:60b] 摘要: 使用MapKit框架地图显示最简单显示地图的代码://// RootViewController.m// CoreLocation//// Copyright (c) 2014年 Y.X. All rights reserved.//#import "RootViewController.h"