Skip to content
An XML/HTML parser for Objective-C, inspired by Hpricot.
Objective-C HTML Ruby
Branch: master
Clone or download
topfunky Merge pull request #85 from Lax/peek
add peekAtSearchWithXPathQuery method
Latest commit ba66fa9 Oct 3, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example Update hpple project Nov 25, 2014
Pod/Classes TFHppleElement.peekAtSearchWithXPathQuery Oct 3, 2017
.gitattributes First import Jan 31, 2009
.gitignore Update hpple project Nov 25, 2014
.travis.yml Added travis Dec 8, 2013
Hpple.podspec Added osx deployment target to podspec May 22, 2015
LICENSE.txt First import Jan 31, 2009
README.markdown Merge pull request #59 from trupin/patch-1 Feb 9, 2017


Build Status


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

Inspired by why the lucky stiff's Hpricot.


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



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


  • 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...


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


  • Internal error catching and messages
  • CSS3 selectors in addition to XPath
You can’t perform that action at this time.