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:
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.
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.