CocoaPods trunk is moving to be read-only. Read more on the blog, there are 14 months to go.
| TestsTested | ✗ |
| LangLanguage | Obj-CObjective C |
| License | MIT |
| ReleasedLast Release | Aug 2017 |
Maintained by Silence0201.
SIParser:一个简单的Html/XML解析器
HTMLParser导入项目中,Bulid Phases->Link FrameWork and Libraries,添加libxml2.tbd或libxml2.dylib
Bulid Setting->header search paths,添加$(SDKROOT)/usr/include/libxml2
pod 'SIParser', '~> 0.1.0'
导入头文件
#import "Parser.h"初始化Parser
NSString *htmlString = @"<username>我是username自定义样式</username><password size='20'>我是password自定义样式,注意属性内容</password>";
SIHTMLParser *htmlParser = [[SIHTMLParser alloc] init];查询节点信息
SINodeList *nodes = [htmlParser nodeListWithString:htmlString];转化为富文本
//自定义样式
NSDictionary *customStyles = @{
NSForegroundColorAttributeName: [UIColor orangeColor],
NSBackgroundColorAttributeName: [UIColor blueColor]
};
[htmlParser addStyle:customStyles forTag:@"username"];
NSAttributedString *attributedString = [htmlParser parseString:htmlString];更多使用请查看头文件说明
SIParser is available under the MIT license. See the LICENSE file for more info.