Hi all,

I've recently been assigned an xml task so I started trying sample code from a popular tutorial site. I can't get any of the samples that use "responseXML" to work. I've been struggling with it for about 3 days and still no luck.

I think it must be something fundamental that I'm leaving out

Would someone please show me what's wrong. I always get the error: "object required" when I try to use:

Code:
xmlDoc.getElementsByTagName("CATALOG")[0].childNodes[0].nodeValue;
Here's the html:
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>

<script type="text/javascript">
function loadxml(){
	if (window.XMLHttpRequest){
		xhttp=new XMLHttpRequest()
	} else {
		xhttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	xhttp.open("GET","cd_catalog.xml",false);
	xhttp.send("");
	xmlDoc=xhttp.responseXML;
}

function showcatalog(){
	document.getElementById("display_catalog").innerHTML=
	xmlDoc.getElementsByTagName("CATALOG")[0].childNodes[0].nodeValue;
}
function showcd(){
	document.getElementById("display_cd").innerHTML=
	xmlDoc.getElementsByTagName("CD")[0].childNodes[0].nodeValue;
}
function showtitle(){
	document.getElementById("display_title").innerHTML=
	xmlDoc.getElementsByTagName("TITLE")[0].childNodes[0].nodeValue;
}
</script>
</head>

<body>
	<h1>Click a button</h1>
	<input id="load" type"button" value="load xml" onclick="loadxml()"></input>
	
	<input id="btn1" type"button" value="button1"  onclick="showcatalog()"></input>
	<input id="btn1" type"button" value="button2" onclick="showcd()"></input>
	<input id="btn1" type"button" value="button3" onclick="showtitle()"></input>

	<p id="display_catalog"></p>
	<p id="display_cd"></p>
	<p id="display_title"></p>
</body>
</html> 
Here's the xml doc:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?> 
- <CATALOG>
- <CD>
  <TITLE>Empire Burlesque</TITLE> 
  <ARTIST>Bob Dylan</ARTIST> 
  <COUNTRY>USA</COUNTRY> 
  <COMPANY>Columbia</COMPANY> 
  <PRICE>10.90</PRICE> 
  <YEAR>1985</YEAR> 
  </CD>
- <CD>
  <TITLE>Hide your heart</TITLE> 
  <ARTIST>Bonnie Tyler</ARTIST> 
  <COUNTRY>UK</COUNTRY> 
  <COMPANY>CBS Records</COMPANY> 
  <PRICE>9.90</PRICE> 
  <YEAR>1988</YEAR> 
  </CD>
- <CD>
  <TITLE>Greatest Hits</TITLE> 
  <ARTIST>Dolly Parton</ARTIST> 
  <COUNTRY>USA</COUNTRY> 
  <COMPANY>RCA</COMPANY> 
  <PRICE>9.90</PRICE> 
  <YEAR>1982</YEAR> 
  </CD>
- <CD>
  <TITLE>Still got the blues</TITLE> 
  <ARTIST>Gary Moore</ARTIST> 
  <COUNTRY>UK</COUNTRY> 
  <COMPANY>Virgin records</COMPANY> 
  <PRICE>10.20</PRICE> 
  <YEAR>1990</YEAR> 
  </CD>
- <CD>
  <TITLE>Eros</TITLE> 
  <ARTIST>Eros Ramazzotti</ARTIST> 
  <COUNTRY>EU</COUNTRY> 
  <COMPANY>BMG</COMPANY> 
  <PRICE>9.90</PRICE> 
  <YEAR>1997</YEAR> 
  </CD>
</CATALOG>