Latest 1.2
Homepage https://github.com/silence0201/SIParser
License MIT
Platforms ios 7.0
Authors

HTMLParser

Language
License
SIParser:一个简单的Html/XML解析器

使用说明

导入

手工导入

  1. 将项目下HTMLParser导入项目中,
  2. 点击Bulid Phases->Link FrameWork and Libraries,添加libxml2.tbdlibxml2.dylib
  3. 在项目设置中Bulid Setting->header search paths,添加$(SDKROOT)/usr/include/libxml2

Pod安装

pod 'SIParser', '~> 0.1.0'

使用

  1. 导入头文件

    #import "Parser.h"
  2. 初始化Parser

    NSString *htmlString = @"<username>我是username自定义样式</username><password size='20'>我是password自定义样式,注意属性内容</password>";
    SIHTMLParser *htmlParser = [[SIHTMLParser alloc] init];
  3. 查询节点信息

    SINodeList *nodes = [htmlParser nodeListWithString:htmlString];
  4. 转化为富文本

    //自定义样式
    NSDictionary *customStyles = @{
                                   NSForegroundColorAttributeName: [UIColor orangeColor],
                                   NSBackgroundColorAttributeName: [UIColor blueColor]
                                   };
    [htmlParser addStyle:customStyles forTag:@"username"];
    NSAttributedString *attributedString = [htmlParser parseString:htmlString];
  5. 更多使用请查看头文件说明

HTMLParser

SIParser is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "SIParser",
    "version": "1.2",
    "summary": "SIParser",
    "description": "An Objective-C wrapper to parse HTML/XML",
    "homepage": "https://github.com/silence0201/SIParser",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Silence": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/silence0201/SIParser.git",
        "tag": "1.2"
    },
    "source_files": [
        "Classes",
        "Classes/**/*.{h,m}"
    ],
    "exclude_files": "Classes/Exclude",
    "libraries": "xml2",
    "xcconfig": {
        "HEADER_SEARCH_PATHS": "$(SDKROOT)/usr/include/libxml2"
    }
}

Pin It on Pinterest

Share This