hpple

An XML/HTML parser for Objective-C, inspired by Hpricot.

  • 所有者: topfunky/hpple
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

Build Status

DESCRIPTION

Hpple: A nice Objective-C wrapper on the XPathQuery library for parsing HTML.

Inspired by why the lucky stiff's Hpricot.

CREDITS

Hpple was created by Geoffrey Grosenbach, Topfunky Corporation and PeepCode Screencasts.

Contributors

FEATURES

  • Easy searching by XPath (CSS selectors are planned)
  • Parses HTML (XML coming soon)
  • Easy access to tag content, name, and attributes.

INSTALLATION

  • Open your Xcode project and the Hpple project.
  • Drag the "Hpple" directory to your project.
  • Add the libxml2.2.dylib framework to your project and search paths as described at Cocoa with Love

More documentation and short screencast coming soon...

USAGE

See TFHppleHTMLTest.m in the Hpple project for samples.

#import "TFHpple.h"

NSData  * data      = [NSData dataWithContentsOfFile:@"index.html"];

TFHpple * doc       = [[TFHpple alloc] initWithHTMLData:data];
NSArray * elements  = [doc search:@"//a[@class='sponsor']"];

TFHppleElement * element = [elements objectAtIndex:0];
[e text];                       // The text inside the HTML element (the content of the first text node)
[e tagName];                    // "a"
[e attributes];                 // NSDictionary of href, class, id, etc.
[e objectForKey:@"href"];       // Easy access to single attribute
[e firstChildWithTagName:@"b"]; // The first "b" child node

TODO

  • Internal error catching and messages
  • CSS3 selectors in addition to XPath

主要指标

概览
名称与所有者topfunky/hpple
主编程语言Objective-C
编程语言Objective-C (语言数: 3)
平台
许可证MIT License
所有者活动
创建于2009-02-01 00:00:26
推送于2021-07-15 04:18:17
最后一次提交2017-10-03 19:56:51
发布数2
最新版本名称0.2.0 (发布于 2013-05-03 09:45:58)
第一版名称0.1.0 (发布于 )
用户参与
星数2.8k
关注者数107
派生数469
提交数83
已启用问题?
问题数53
打开的问题数36
拉请求数25
打开的拉请求数3
关闭的拉请求数6
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?