Re: Function to escape illegal XML characters in NSString
Re: Function to escape illegal XML characters in NSString
- Subject: Re: Function to escape illegal XML characters in NSString
- From: Chris Parker <email@hidden>
- Date: Thu, 4 Dec 2003 11:20:58 -0800
Hi Frank,
On Dec 4, 2003, at 6:29 AM, Frank wrote:
Does anyone know which function I can use to escape illegal XML
characters such as <>& in NSString objects. I assume there is such a
function as property lists are xml encoded.
We did put in some new API for this:
CF_EXPORT
CFStringRef CFXMLCreateStringByEscapingEntities(CFAllocatorRef
allocator, CFStringRef string, CFDictionaryRef entitiesDictionary)
AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
CF_EXPORT
CFStringRef CFXMLCreateStringByUnescapingEntities(CFAllocatorRef
allocator, CFStringRef string, CFDictionaryRef entitiesDictionary)
AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
So just cast your NSString over and you're all set. This is a "Create"
CF routine, so you'll have to explicitly handle the release/autorelease
yourself.
.chris
--
Chris Parker
Cocoa Frameworks Engineer
Apple Computer, Inc.
_______________________________________________
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.