On Sep 6, 2011, at 11:53 AM, Jens Alfke wrote:

> On Sep 6, 2011, at 11:11 AM, Michael Thon wrote:
> 
>> Yup, they're HTML, all right. Now I'm thinking of moving this code to a 
>> separate command line app that I can call from the main application. It 
>> should work, but I'm not sure if I'd need to provide a runloop for the HTML 
>> importing to work.
> 
> The background tool will need to link against WebKit and AppKit, so it won’t 
> be strictly-speaking ‘background’. You can mark its bundle with a special key 
> (LSBackgroundOnly?) to keep it from showing up in the Dock or getting a 
> menu-bar though.
> 
> The bigger problem is how this tool sends results back to the main app. An 
> NSAttributedString is an in-memory object, and the tool has a separate 
> address space. I guess you could try archiving the string and sending back 
> the data, but I’m not sure whether all the different attribute values used in 
> parsed HTML are archivable.
> 
> What do you use the attributed string for, if this is a background-only 
> operation? Maybe there’s a less expensive way to accomplish it.

One possibility would be to convert the HTML to RTF or RTFD, which could be 
loaded in the background.  For that sort of conversion we already have a tool 
on the system, /usr/bin/textutil.  There are also other potential methods for 
parsing HTML, if the intent is for something other than full editable rich text 
support.

Douglas Davidson

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to