<commit_before># DESCRIPTION

EXPERIMENTAL! Only a few hours old.

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

Inspired by why the lucky stiff's [Hpricot](http://github.com/why/hpricot/tree/master).

# AUTHOR

<NAME>, [Topfunky Corporation](http://topfunky.com) and [PeepCode Screencasts](http://peepcode.com).

# 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](http://cocoawithlove.com/2008/10/using-libxml2-for-parsing-and-xpath.html)

More documentation and short screencast coming soon...

# USAGE

See TFHppleHTMLTest.m in the Hpple project for samples.

<pre>
#import "Hpple.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 content];              // Tag's innerHTML
[e tagName];              // "a"
[e attributes];           // NSDictionary of href, class, id, etc.
[e objectForKey:@"href"]; // Easy access to single attribute

</pre>

# TODO

* Internal error catching and messages
* CSS3 selectors in addition to XPath<commit_msg>Corrected usage sample in README, again<commit_after># DESCRIPTION

EXPERIMENTAL! Only a few hours old.

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

Inspired by why the lucky stiff's [Hpricot](http://github.com/why/hpricot/tree/master).

# AUTHOR

<NAME>, [Topfunky Corporation](http://topfunky.com) and [PeepCode Screencasts](http://peepcode.com).

# 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](http://cocoawithlove.com/2008/10/using-libxml2-for-parsing-and-xpath.html)

More documentation and short screencast coming soon...

# USAGE

See TFHppleHTMLTest.m in the Hpple project for samples.

<pre>
#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 content];              // Tag's innerHTML
[e tagName];              // "a"
[e attributes];           // NSDictionary of href, class, id, etc.
[e objectForKey:@"href"]; // Easy access to single attribute

</pre>

# TODO

* Internal error catching and messages
* CSS3 selectors in addition to XPath
{'fraction_non_alphanumeric': 0.11423841059602649, 'fraction_numerical': 0.00728476821192053, 'mean_word_length': 3.904220779220779, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3046814', 'n_tokens_mistral': 1015, 'n_tokens_neox': 965, 'n_words': 322}