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

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.