hpple

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

  • Owner: topfunky/hpple
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

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

Main metrics

Overview
Name With Ownertopfunky/hpple
Primary LanguageObjective-C
Program languageObjective-C (Language Count: 3)
Platform
License:MIT License
所有者活动
Created At2009-02-01 00:00:26
Pushed At2021-07-15 04:18:17
Last Commit At2017-10-03 19:56:51
Release Count2
Last Release Name0.2.0 (Posted on 2013-05-03 09:45:58)
First Release Name0.1.0 (Posted on )
用户参与
Stargazers Count2.8k
Watchers Count107
Fork Count469
Commits Count83
Has Issues Enabled
Issues Count53
Issue Open Count36
Pull Requests Count25
Pull Requests Open Count3
Pull Requests Close Count6
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private