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?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?