2 Replies Latest reply on Jan 28, 2007 9:41 AM by Jadeivy

    XML Output Format Error

    Jadeivy
      I'm having issues trying to get proper XML formatting with my output as below:


      var loaderMC = _root.createEmptyMovieClip("loader_mc", 1234);
      loaderMC.filename = "filename.xml";
      loaderMC.data = "<blah> here's some data </blah>";
      loaderMC.getURL(" http://server.com/saveData.php", '_blank', 'POST');


      When I try to add additional lines I get validation errors in flash (Actionscript).

      Plus when I append the XML header, flash thinks the tags represent the end of my data:

      <?xml version="1.0" encoding="UTF-8"?>

      The "1.0" ruins flashes ability to find the end of my data line.

      How can I a) Format my output XML so that it saves locally in the proper format such as:

      <?xml version="1.0" encoding="UTF-8"?>
      <blah>here's some data</blah>
      <moreblah>
      <evenMore>Third Aggregate</evenMore>
      </moreblah>

      And b) how can I output flash restrictive characters without upsetting my flash?

      Thanks a ton!
        • 1. XML Output Format Error
          Jadeivy Level 1
          Edited accidental double reply.

          Message in next post.
          • 2. Re: XML Output Format Error
            Jadeivy Level 1
            I don't think I did a good job explaining my situation - so here goes round 2.

            I've created a flash form that allows the user to export the info (in the form) to an XML file that the user can store local on thier system.

            This is done by using this code:

            var loaderMC = _root.createEmptyMovieClip("loader_mc", 1234);
            loaderMC.filename = "filename.xml";
            loaderMC.data = "<blah> here's some data </blah>";
            loaderMC.getURL(" http://server.com/saveData.php", '_blank', 'POST');

            On the php server the code looks like this:

            <?php
            header("Content-Type: application/octet-stream");
            header("Content-Transfer-Encoding: binary");
            header("Content-Length: ". strlen($_POST["data"]));
            header("Content-Disposition: attachment; filename=\"" .
            $_POST["filename"].'"');

            print($_POST["data"]);

            ?>


            The problem is that it will save the single line of data as XML.

            I want to add additional lines.

            How can I do this with this line?

            loaderMC.data = "<blah> here's some data </blah>";

            Or do I have to create a var that contains all the elements and then pass that var to:

            loaderMC.data = theNewVar;


            Thanks!