On Oct 29, 2012, at 6:55 AM, Vincent Habchi <vi...@macports.org> wrote:

> Le 29 oct. 2012 à 14:34, Mike Abdullah <cocoa...@mikeabdullah.net> a écrit :
> 
>> Well, you can ask CFXMLCreateStringByUnescapingEntities() to do this on OS 
>> X, although if I recall all the CFXML functions have now sadly been 
>> deprecated. The source code for it should still be available if you search 
>> around.
> 
> I wasn’t aware of those calls. They do not seem to be deprecated. However, I 
> have also a lot of accented characters (é, à, û, etc.) to unescape (since the 
> contents are in French), and CFXMLCreateStringByUnescapingEntities() provides 
> a basic dictionary of only five elements; it is extensible, but of course at 
> the expense of creating a custom dictionary,

Actually, it's not. From the docs:

> Note: Currently, only the standard predefined entities are supported; passing 
> NULL for entitiesDictionary is sufficient. 
> 
This kind of thing is why CFXML is deprecated.

> 
>> But in general, I would just work my way through the string looking for 
>> occurrences of '&' and see if that makes up a valid escape sequence. Much of 
>> the problem if dealing with HTML rather than XML is that there are a vast 
>> range of special sequences. e.g. &micro;
> 
> Yeah, that’s what I thought of. I will add a note in the body of the article 
> about this.

I haven't tried it myself, but maybe you can construct an NSXMLDTD that 
references the standard HTML DTD and query it for entity expansions?

--Kyle Sluder
_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Reply via email to