Jump to content

[SOLVED] PHP returning XML - but isnt in XML format


PC Nerd

Recommended Posts

Hi,

 

Im learnign AJAX - teaching myself, and Ive figured out that the PHP script isnt sending my data in XML format.

 

My code is in following.

<!--<xml version = '1.0'encoding = 'UTF-8' standalone = 'yes'>-->
<xml version="1.0" encoding="utf-8">
<?php

while($ROW = mysqli_fetch_assoc($QUERY)) {
echo "<student id='".$ROW['Student_ID']."'>\n";
echo "<name>".$ROW['Name']."</name>\n";
...

 

 

ive had to block out the rest of the loop because it contains private ingformation - but I can garentee that it is returned as appearing as XML - ie the correct tags, and viewd in source etc.

 

 

for those tha tknow AJAX - the responseXML is null, and then responseText returns what I want it to -= only its not in teh XML format.

 

I have a feeling that its with the <xml> declaration at the topm but im not great with XML and Im not sure if there is an issue with that.

 

Thanks for and all help

i dont no much about phrasing xml in javascript but i thourght you had yo open it with something like this

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

insted of

<!--<xml version = '1.0'encoding = 'UTF-8' standalone = 'yes'>-->

<xml version="1.0" encoding="utf-8">

Scott.

 

hi

 

i tried removeing the <!-- --> line but it made no difference.  I had commented out my original xml tag because i thoguth the current one might work better = however there is no difference.

 

any other suggestions?

 

thanks for oyu help so far

cant you just change the top of your code to this

 

<?xml version="1.0" encoding="utf-8"?>
<?php

while($ROW = mysqli_fetch_assoc($QUERY)) {
echo "<student id='".$ROW['Student_ID']."'>\n";
echo "<name>".$ROW['Name']."</name>\n";
...

 

Scott.

no

 

my php is interpreting that as <? PHP CODE ?>  - ie shot tags

ive echoed it out and escaped characters and its still not working.

 

eg:

 

the page that AJAx connects to that returns XML  is returnData.php

 

if i go to it on firefox and i view the data in page source its all there.  if i view page info in firefox... then i get: text/html

if thats an issue - or its jsut firefox handling the xml then i dont know - but its just somethign I noticed.

 

thaks for the suggestions- any other ideas?

 

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.