Re: Removing HTML Tags
Re: Removing HTML Tags
- Subject: Re: Removing HTML Tags
- From: Dan Wood <email@hidden>
- Date: Mon, 29 Apr 2002 19:52:52 -0700
I do something kind of evil: I "render" the HTML into an
attributed string, and then take the flat string out of that.
Probably a bit inefficient, but it seems to work. Plus, it
renders the &-sequences as well..
- (NSString *) flattenHTML
{
NSString *result = self;
NSAttributedString *attrString;
NSData *theData = [self
dataUsingEncoding:NSMacOSRomanStringEncoding]; // encoding for
below to work
if (nil != theData)
{
attrString
= [[[NSAttributedString alloc]
initWithHTML:theData documentAttributes:nil] autorelease];
result = [attrString string];
}
return result;
}
On Monday, April 29, 2002, at 05:12 pm, email@hidden wrote:
Hi folks! I'm looking for a way to remove HTML tags from an
NSString. I think it might be possible via an NSScanner, but
I'm not sure how to go about it. Any suggestions?
Owen Anderson
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
--
Dan Wood
Karelia Software, LLC
email@hidden
http://www.karelia.com/
Watson for Mac OS X:
http://www.karelia.com/watson/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.