• 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
NSXMLDocument Not Encoding \r\n or \n to 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSXMLDocument Not Encoding \r\n or \n to 


  • Subject: NSXMLDocument Not Encoding \r\n or \n to 
  • From: James Wilson <email@hidden>
  • Date: Fri, 25 Nov 2005 14:44:58 +1100

All,

I've noticed that when libxml2 is given a string containing "\r\n" characters in it, it correctly encodes these as '&#xD;' in the XML output it produces. However, when an NSXMLDocument exists and a node is created as [NSXMLNode elementWithName:@"entry" stringValue:[self entry]] where the stringValue string contains "\r\n" or "\n" characters, it does NOT encode them as '&#xD;'. It simple treats them as part of the string. This causes me all manner of trouble when this XML is sent to another machine and it parses it. Obviously, the CRLF/ LFs go missing. Annoyingly, if I substitute all instances of "\r\n" or "\n" in a string with '&#xD;' they get encoded as "&amp;#xD;" which causes even more problems.

So, my question is, how can I ensure that when a string containing multiple lines (with either \n or \r\n line endings) is used to create an NSXMLNode that when the XML output is retrieved using the XMLData or XMLString methods on NSXMLDocument that it contains properly encoded \r\n and \n characters?

Thanks,




------------------------[ www.lithiumcorp.com ]----- James Wilson phone: 02 8920 8711 CCIE #6662 mobile: 0422 22 3742

LithiumCorp
Network Design, Implementation and Management Systems
-----------------------------------------------------

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the originator of the message and permanently delete it from your computer.


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Apple Defined UTIs
  • Next by Date: CoreData, adding & removing objects via NSArrayController
  • Previous by thread: Re: Apple Defined UTIs
  • Next by thread: CoreData, adding & removing objects via NSArrayController
  • Index(es):
    • Date
    • Thread