Those are for URL encoding; I think he wants HTML entities. I can't remember if there are Cocoa methods to do this, but you can use CFXMLCreateStringByEscapingEntities() (since NSString * and CFStringRef are toll-free bridged):

NSString *input = @"2 < 4";
NSString *output = (NSString *)CFXMLCreateStringByEscapingEntities(NULL, (CFStringRef)input, NULL);

Should result in output being @"2 &lt; 4".

Just remember that the output string will need to be released.

On Aug 21, 2008, at 1:32 PM, Randall Meadows wrote:

On Aug 21, 2008, at 12:16 PM, JanakiRam wrote:

I'm developing an Cocoa client application.As part of application logic , i make the Webservice Call with XML data - which returns the XML file as response which contains the HTML code for the special characters. While
sending the data i need to convert the special characters such as &,'
etc.... with their HTML Codes/equivalents and also need to extract the string by replacing the HTML codes while retrieving the data. Can any one
suggest me the preferred way to convert/extract HTML Codes.

Take a look at the NSString documentation, the "Working with URLs" section:

– stringByAddingPercentEscapesUsingEncoding:
– stringByReplacingPercentEscapesUsingEncoding:

_______________________________________________

Cocoa-dev mailing list ([email protected])

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/nateweaver%40xtechllc.com

This email sent to [EMAIL PROTECTED]


_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [EMAIL PROTECTED]

Reply via email to