Get Updates By E-mail 

Article Written By:
Johann Dowa

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.


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments