NSAttributedString and HTML
NSAttributedString and HTML
- Subject: NSAttributedString and HTML
- From: Chris Hanson <email@hidden>
- Date: Sat, 21 Sep 2002 00:11:34 -0500
There's got to be something I'm just missing here.
I'm trying to create an attributed string with the HTML that I have
in another string. I'm doing this from within an NSText delegate
method, -[MyDocument textDidChange:]. I'm using Mac OS X 10.2.1 with
the latest everything.
Here's my code:
- (NSAttributedString *)attributedStringForHTML:(NSString *)rawString
{
NSData *rawStringData;
NSAttributedString *htmlString;
rawStringData = [rawString dataUsingEncoding:NSUTF8StringEncoding];
htmlString = [[[NSAttributedString alloc] initWithHTML:rawStringData
documentAttributes:NULL] autorelease];
return htmlString;
}
What's strange is that as soon as it hits -[NSAttributedString
initWithHTML:documentAttributes:], it throws an exception:
Exception raised during posting of notification. Ignored.
exception: *** +[MyDocument attributedStringWithHTML:documentAttributes:]:
selector not recognized
Of course it's not recognized! I don't want to write my own HTML
parser, that's what the AppKit additions to NSAttributedString are
for! And how the heck is it getting at MyDocument?
What's odd is that using NSAttributedString like this to work fine
for projects like Cocoa Browser. And it certainly doesn't have an
implementation of +[MyDocument
attributedStringWithHTML:documentAttributes:]. What's going on?
-- Chris
--
Chris Hanson | Email: email@hidden
bDistributed.com, Inc. | Phone: +1-847-372-3955
Making Business Distributed | Fax: +1-847-589-3738
http://bdistributed.com/ | Personal Email: email@hidden
_______________________________________________
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.