Open Source iOS Library Inspired By Nokogiri and JQuery For Easier XML/HTML Parsing

Last year I mentioned a tutorial showing how to perform basic XML parsing using libxml and Hpple.

Here’s a library inspired by Nokogiri and JQuery from Francis Chong that makes it easier to parse XML and HTML on the iOS platform called IGHTMLQuery.

IGHTMLquery supports XPath searching, and you can chain commands just like with JQuery. IGHTMLQuery uses libxml behind the scenes.

Here’s an example from the readme demonstrating querying with IGHTMLQuery in Objective-C:

IGXMLDocument* node = [[IGXMLDocument alloc] initWithXMLString:catelogXml error:nil];
NSString* title = [[[node queryWithXPath:@"//cd/title"] firstObject] text];
[[node queryWithXPath:@"//title"] enumerateNodesUsingBlock:^(IGXMLNode *title, NSUInteger idx, BOOL *stop) {
NSLog(@"title = %@", title.text);
}];

// quick manipulation
[[node queryWithXPath:@"//title"] appendWithXMLString:@"Hi!"];

You can find IGHTMLQuery on Github here.

A handy library for parsing XML/HTML.

FacebookTwitterDiggStumbleUponGoogle Plus

Original article: Open Source iOS Library Inspired By Nokogiri and JQuery For Easier XML/HTML Parsing

©2013 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.

Leave a Reply

Your email address will not be published. Required fields are marked *