1 Reply Latest reply on Feb 6, 2010 9:45 AM by Chris McLaughlin

    Formatting XML output with line breaks

    Chris McLaughlin Level 1



      I'm working on a project in which user data will be saved via php to an xml file on the sever.  Using Kirupa's excellent tutorial (http://www.kirupa.com/web/xml/examples/simpleeditor.htm), I am able (now) to output to the xml file.  My question is, does anyone know of a way to create the xml file so that the nodes will appear on seperate lines, as it would were I creating the XML file using Dreamweaver say.


      IOW, is there a way to format the xml to look like this . . .






      as opposed to this . . .




      Each user entry will have a lto of information, and while I know I can parse it by loading it back inot Flash, it would be great to be able to more easily examine the XML file in Dreamweaver.


      Thanks in advance for any help you can provide.







        • 1. Re: Formatting XML output with line breaks
          Chris McLaughlin Level 1

          Duh . . . in the referenced blog there was a section dealing with my question.  I guess it pays to read further.  Anyway, while I didn't use the script therein, the basic question was answered that yes you can format xml using "\n" or newline to create a new line, and "\t" to create a tab.  The rest simply involved stepping through the nodes ( I used a for var < childNode.length approach) and adding the desired formatting.  Now I need to test to see if it will write using the xml.sendAndLoad method or whether I need to move to loadVars as guessed by the blog author.