PDA

View Full Version : php + xml.onload response code -6


graeme_deacon
04-14-2006, 12:40 AM
So I have a very simple php page called nums.php that outputs some xml.

<?php
echo '<root>Hello</root>';
?>

can't get any simpler than that!

Now I have a flash movie with a submit button (instance name: submit_tickets) and an input text box (instance name: ticket_input) that I'm just using to output the result into for now. I have the following actionscript attached to the button.

on(release){
var content_xml:XML = new XML();

content_xml.onLoad = function(success){
if(success)
{
ticket_input.text = content_xml.toString();
trace(content_xml.status);
}
else
{
trace("failure");
}
}

content_xml.load("nums.php");
}


When I publish this movie and click the button I get a trace output of -6. According to macromedia this means "-6 An XML element was malformed." However when I just publish the same xml in a plain-text "nums.xml" document it works fine and has a return code of 0.

I've already tried putting <?xml version="1.0" ?> in front of the xml to no avail. I also turned on the output buffering in php.ini just to see of that was the problem.

Any help is greatly appreciated.

HITdrumHARD
04-20-2006, 09:44 PM
try adding:

content_xml.ignoreWhite = true;

HITdrumHARD
04-20-2006, 09:46 PM
also, do browsers that recognize XML (like FireFox) display it as well formed XML? If not then your php file may need to set the content-type of its response to text/xml.

graeme_deacon
04-27-2006, 04:58 PM
Actually, I discovered that if I used the absolute address instead just a relative address it works fine on my home server. On my production server using just a relative address is sufficient. So I think it may be related to either my php.ini or httpd.conf.

Thanks for your suggestions.