A delightful xml and html parsing relish for iOS
For parsing html, we can use the code below:
NSString *webFile = [[NSBundle mainBundle] pathForResource:@"demo" ofType:@"xml"];
NSString *webStr = [NSString stringWithContentsOfFile:webFile
encoding:(NSUTF8StringEncoding)
error:nil];
HTMLTagParser *parser = [HTMLTagParser parserWithWebPageContent:webStr tagName:obj];
Or if needing parsing xml, we can use the method:
XMLTagParser *parser = [XMLTagParser parserWithWebPageContent:self.xmlContent tagName:obj];
In addition, if we could't know the type of webpage is html or xml,we can use
TagParser *parser = [TagParser parserWithWebPageContent:self.xmlContent tagName:obj];
RegExCategories