Open Source iOS Library For Easy HTML Parsing That Can Handle Malformed HTML Like A Browser

I’ve mentioned a number of open source libraries for parsing HTML most recently the Nokogiri inspired Ono library that uses libxml2.

Here’s an open souce parsing HTML parsing library that does not use libxml2 and can handle broken markup just like a browser called HTMLReader from Nolan Waite.

HTMLReader is WHATWG compliant and works with CSS selectors so if you are working with possibly malformed HTML and are looking for a library that treats html like a browser it looks like a good choice.

Here’s a usage example from the readme showing the HTMLReader syntax:

#import <htmlreader /HTMLReader.h>

NSString *html = @"

<b>Ahoy there sailor!</b>

";
HTMLDocument *document = [HTMLDocument documentWithString:html];
NSLog(@"%@", [document firstNodeMatchingSelector:@"b"].textContent); // => Ahoy there sailor!

You can find HTMLReader on Github here.

A nice html parsing library.

FacebookTwitterDiggStumbleUponGoogle Plus

Original article: Open Source iOS Library For Easy HTML Parsing That Can Handle Malformed HTML Like A Browser

©2014 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 *