Skip navigation
Currently Being Moderated

dynamic xml from php script throws error: #1088 or #1085

Sep 6, 2012 5:40 AM

Tags: #php #as3 #xml

Hi,

 

I'm importing xml formatted data from mysql via php script:

[code]

<?php

require_once('require.php');

$result = mysql_query("SELECT * FROM `songs`");

if($result)

{

    header ("Content-Type: text/xml");

    echo"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";

    echo"<songComments>\n";

    while ($row = mysql_fetch_array($result))

    {

        echo"<testimonial>\n";

        echo"<songComment>" . $row['title'] . "</songComment>\n";

        echo"</testimonial>\n";

    }

    echo"</songComments>\n";

}

?>

[/code]

In one of my flash projects it's working just fine. But in the new one that I just sterted not anymore. And i have no idea why. I get this errors:

 

TypeError: Error #1085: The element type "songComments\n" must be terminated by the matching end-tag "</songComments\n>".

or:

TypeError: Error #1088: The markup in the document following the root element must be well-formed.

 

When I output that php into txt file and loaded in flash everything is fine, but not from php script directly.

 

Could it have something to do with that I'm testing that mysql locally on my computer using WAMP ? Previous project got all data from mysql from server.

 
Replies
  • Currently Being Moderated
    Sep 6, 2012 5:54 AM   in reply to TrueSign

    I would guess it is a WAMP issue.  If this has worked without issue on a server, then the PHP file should not be an issue.  It appears WAMP is not presenting the  data correctly.  Try tracing what the Flash file sees and see if it is combining the \n with the tag name.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 6, 2012 6:32 AM   in reply to TrueSign

    Try tracing event.target.data before you try to convert it to XML.  The attempt to convert it to XML is what is causing the error so trying to trace it afterwards won't happen since it doesn't get that far. 

     

    Don't change the data file to try to solve the problem. 

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 6, 2012 7:33 AM   in reply to TrueSign

    If it is tracing the contents of the php file, then the php file is not being processed.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points