3 Replies Latest reply on Apr 23, 2008 3:59 PM by fisad

    Content is not allowed in prolog

    fisad
      I try php code attached (tree_source.php), but, in Flex Builder 3 application, line 43:

      <mx:XML id="dp" source="data/tree_source.php" />

      Flex show the error:

      "Problem parsing external XML: C:\xampp\htdocs\Tree Gallery\src\data\tree_source.php - (line 43) Content is not allowed in prolog."

      ??? Any help me, please.

      Thnak in advance
        • 1. Re: Content is not allowed in prolog
          levancho Level 3
          execute this : C:\xampp\htdocs\Tree Gallery\src\data\tree_source.php
          in your browser and make sure xml has no spaces or some other chars on top, or somewhere else, it must be well formed xml.
          • 2. Re: Content is not allowed in prolog
            fisad Level 1
            I execute code in browser and don't show has no spaces or some other chars somewhere, I saved with notepad in correct format but nothing.

            I have following code for create xml file with php, this xml file read correct in Flex:

            -------------------------------------
            <?php
            $path = "images";

            $fp=fopen("data/tree_source.xml","w");
            fwrite($fp,'<?xml version="1.0" encoding="UTF-8"?>' . "\n");
            fwrite($fp,"<root>"."\n");

            structure($path,$fp,$path);

            fwrite($fp,"</root>");
            fclose($fp);


            // Function
            function structure($rootdirpath,$fp,$dir)
            {
            unset($root);
            if($dp = @opendir($rootdirpath))
            {
            for($i=0;($file=readdir($dp))!==false;$i++)
            {
            if (is_dir($rootdirpath."/".$file) && $file != "." && $file != "..")
            {
            fwrite($fp,"<node label=\"".$file."\">"."\n");
            structure($rootdirpath."/".$file,$fp,$dir);
            fwrite($fp,"</node>\n\r");
            }

            }
            }
            closedir($dp);

            }


            ?>
            ------------------------------

            I need know how execute this code from Flex at any time for refresh contens of tree, one at start application, other when de directory structure has changed.

            Any example code for help me, please.

            Thank in advance-
            • 3. Re: Content is not allowed in prolog
              fisad Level 1
              the problem was php file location, put in directory en root of web server and all ok,

              I need help for run php scripts from flex application at any time for refresh tree contens when they changed-

              Thank for your help.