Resolve html properties while parsing
How can I remove HTML entities from parsing XML??
Means i am parsing XML but 开发者_C百科I'm not able to remove <br/>
,
etc.
You mean something like this?
/**
* Removes the HTML tags found in the string
* @param html the string to scan
*
* @returns the original string without tags
*/
- (NSString *)flattenHTML:(NSString *)html {
NSScanner *thescanner;
NSString *text = nil;
thescanner = [NSScanner scannerWithString:html];
while ([thescanner isAtEnd] == NO) {
// find start of tag
[thescanner scanUpToString:@"<" intoString:NULL];
// find end of tag
[thescanner scanUpToString:@">" intoString:&text];
// replace the found tag with a space
html = [html stringByReplacingOccurrencesOfString:
[NSString stringWithFormat:@"%@>", text]
withString:@" "];
} // while //
return html;
}
[NSString stringByReplacingOccurrencesOfString:@","withString:@""];
Try to use this function, replace symbols witch you want.
精彩评论