WebKit & Objective-C: how to parse a HTML string into a DOMDocument?
- by Rinzwind
How do you get a DOMDocument from a given HTML string using WebKit? In other words, what's the implementation for DOMDocumentFromHTML: for something like the following:
NSString * htmlString = @"<html><body><p>Test</body></html>";
DOMDocument * document = [self DOMDocumentFromHTML: htmlString];
DOMNode * bodyNode = [[document getElementsByTagName: @"body"] item: 0];
// ... etc.
This seems like it should be straightforward to do, yet I'm still having trouble figuring out how :( ...