XML, string, and the missing new line issue


/ Published in: ActionScript 3
Save to your folder(s)

For some reason if you load in text from an xml file and the text has a newline character(\n or \r), the newline character doesn't create a new line but shows up in the text instead.


Copy this code and paste it in your HTML
  1. // In your XML, change \n to \\n.
  2.  
  3. yourXMLString = yourXMLString.split("\\n").join("\n");

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.