Skip to content
 
 

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OCGumbo - An Objective-C HTML5 parser.

OCGumbo is an Objective-C wrapper of the Google Gumbo.

Basic Usage

  1. Add Gumbo sources or lib to your project.
  2. Add OCGumbo file and import "OCGumbo.h", then use OCGumboDocument to parse an html string.
OCGumboDocument *document = [[OCGumboDocument alloc] initWithHTMLString:htmlString];
OCGumboElement *root = document.rootElement;
//document: do something with the document.
//rootElement: do something with the html tree.

Extension

Now, OCGumbo add more Query support, add "OCGumbo+Query.h" and enjoy it.

####Query APIs####

.Query();
.attr();
.text();
.find();
.children();
.parent();
.parents();
.first();
.last();
.get();
.index();
.hasClass();

####Examples:####

NSLog(@"options: %@", document.Query(@"body").find(@"#select").find(@"option"));
        
NSLog(@"title: %@", document.Query(@"title").text());
        
NSLog(@"attribute: %@", document.Query(@"select").first().attr(@"id"));

NSLog(@"class: %@", document.Query(@"#select").parents(@".main"));

About

An Objective-C HTML5 parser.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors