GithubHelp home page GithubHelp logo

wentaozone / hpple Goto Github PK

View Code? Open in Web Editor NEW

This project forked from topfunky/hpple

0.0 2.0 0.0 109 KB

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

Home Page: http://topfunky.com

License: MIT License

hpple's Introduction

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.

AUTHOR

Geoffrey Grosenbach, Topfunky Corporation and PeepCode Screencasts.

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

TODO

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

hpple's People

Contributors

topfunky avatar mattjgalloway avatar saleh-hosseinkhani avatar davydotcom avatar 3lvis avatar

Watchers

James Cloos avatar 开水白菜 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.