Skip navigation.
 
mlProblem with CFXMLCreateStringByEscapingEntities to replace special xml chars?
FROM : Benjamin Levy
DATE : Sun Oct 17 06:58:43 2004

Hello,
I've used CFXMLCreateStringByUnescapingEntities before with no
problems, but I'm getting a consistent but unexpected result with
CFXMLCreateStringByEscapingEntities now that I'm using it for the first
time.  It seems that the returned string only includes up to the last
replaced entity and cuts the rest of the string out and if there are no
entities it returns an empty string.

NSString* a = @"one < two";
NSString* b = (NSString*)CFXMLCreateStringByEscapingEntities(
kCFAllocatorDefault, (CFStringRef)a, NULL );
NSLog( @"String \"%@\" became \"%@\"", a, b );

Results in: String "one < two" became "one &lt;"

Not much comes up when searching for
CFXMLCreateStringByEscapingEntities, but is this a known behavior
and/or bug?  Am I somehow doing something wrong here?

Thanks for any thoughts or help,
Ben Levy

Related mailsAuthorDate
mlProblem with CFXMLCreateStringByEscapingEntities to replace special xml chars? Benjamin Levy Oct 17, 06:58
mlRe: Problem with CFXMLCreateStringByEscapingEntities to replace special xml chars? Steven Kramer Nov 2, 13:46