Jump to content

Problem with SimpleXML


Recommended Posts

I'm working with a Flash application that calls data from an XML file.  I want to dynamically update the XML via Ajax based on user input.  I've been able to do this using SimpleXML's asXML when I output the new XML to a new file that the Flash app subsequently calls.  However, when I try to return the updated XML with asXML to the client as a string, it doesn't work.  I can't access the XML at all on the client side (I've tried accessing individual nodes using JS, but no luck).  But when I look at the source of the PHP page, the XML is there. 

 

I've made ZERO other changes.  Can anyone tell me what the problem is?  I'm a relative newb programmer, and this problem has caused huge headaches already. 

 

Here is the PHP code snippet...

 

$original = simplexml_load_file("file.xml");

 

//Manipulate XML with PHP XML commands... no echoing...

 

echo $original->asXML(); // echo the whole thing as a string...

 

Again, if I do this...

 

$original->asXML("newFile.xml");

 

... everything works just fine.

 

TIA for any help...

Link to comment
https://forums.phpfreaks.com/topic/164790-problem-with-simplexml/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.