• 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
FW: Re : NSString to xml?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 &lt;'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:@"&amp;"];
> else if (c == '<')
> [ms appendString:@"&lt;"];
> else if (c == '>')
> [ms appendString:@"&gt;"];
> 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.

  • Prev by Date: Re: Document-based apps interacting with main menu
  • Next by Date: Re: Document-based apps interacting with main menu
  • Previous by thread: Re: link between classes using a class variable
  • Next by thread: Undefined symbols at launch time: _NSApplicationLoad
  • Index(es):
    • Date
    • Thread