Php xml

So i have a schoolproject were i have to build a “AJAX” website

I get result from mysql with php and want to send it as xml to java, but something dosent go right.
Can someone please tell me whats wrong with this


header("Content-type: text/xml");
echo "
	<?xml version='1.0' ?>
	<date>
		<year>2010</year>
		<month>05</month>
		<day>05</day>
		<hour>23</hour>
		<minute>30</minute>
	</date>
";

couse when i get it to the javascript and alert it i get “object HTMLCollection”
I should get “object XMLCollection”, i cant really see something wrong with it so i need a new set of eyes.

You need to set the content type of the AJAX request to text/xml. Additionally, you will need to access the data using responseXML rather than responseText. That is if you want to manipulate the XML structure vs. plain text.

Thanxs for the response.

I have done that but i realized something

if i use
var xmldoc = this.XHRObject.responseXML;
alert(xmldoc) i get “object XMLCollection”

but if i use
var root = xmldoc.getElementsByTagName(‘root’);
alert(root) i get “object HTMLCollection”

and if i had [0], item(0) to the end i get undefined or null

any ideas?