• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Function to escape illegal XML characters in NSString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Function to escape illegal XML characters in NSString (From: Frank <email@hidden>)

  • Prev by Date: NSController and Threads
  • Next by Date: NSScrollView and autohiding scrollers
  • Previous by thread: Function to escape illegal XML characters in NSString
  • Next by thread: How to set resolution of NSImage?
  • Index(es):
    • Date
    • Thread