FW: Re : NSString to xml?
FW: Re : NSString to xml?
- Subject: FW: Re : NSString to xml?
- From: jean-michel daix <email@hidden>
- Date: Wed, 05 Feb 2003 15:21:24 +0100
Try to find in the archives of the mailing list this topic :
"XML-/HTML-safe formatted output from NSString"
And See in the documentation :
-[NSMutableString replaceOccurrencesOfString:withString:options:range:]
-----------------------------------
Jean-Michel DAIX / <email@hidden>
Sorry, I m French ! ( U know, the "Old Europe" )
visit <
http://www.adforum.com>
>
I'm working with the WebServices stuff, and I noticed that when I add a
>
NSString (among other objects) to
>
the WSMethodInvocationSetParameters function, it's not getting serialized...
>
(ie, <'s turned into <'s)
>
ok, I can do that myself I guess... so I wrote a quick little function to do
>
this, but for some reason it
>
gives me the creeps... surely there's an api out there that I'm missing that
>
will do this for me, right?
>
Well, I've looked and I can't seem to find it.. has anyone got any
>
suggestions?
>
>
And here's my quick little function that I was talking about-
>
>
NSString* escapeString(NSString* s) {
>
NSMutableString *ms = [NSMutableString string];
>
const char *temp = [s cString];
>
char c;
>
int i, len = [s cStringLength];
>
>
for (i=0; i<len; i++) {
>
c = temp[i];
>
>
if ((int)c > 127) // warning: comparison is always false due to limited
>
range of data type
>
[ms appendString:[NSString stringWithFormat:@"&#%d;", c]];
>
else if (c == '&')
>
[ms appendString:@"&"];
>
else if (c == '<')
>
[ms appendString:@"<"];
>
else if (c == '>')
>
[ms appendString:@">"];
>
else
>
[ms appendString:[NSString stringWithFormat:@"%c", c]];
>
}
>
return ms;
>
}
------ Fin du message transfiri
_______________________________________________
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.