OCGumbo is an Objective-C wrapper of the Google Gumbo.
- Add Gumbo sources or lib to your project.
- 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.
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"));