Here's how to display an XML file as an HTML table bar,
<script type= "Text/javascript" >
var xmlhttp;
function Loadxmldoc (URL)
{
Xmlhttp=null;
if (window. XMLHttpRequest)
{//code for IE7, Firefox, Mozilla, etc.
Xmlhttp=new XMLHttpRequest ();
}
else if (window. ActiveXObject)
{//code for IE5, IE6
Xmlhttp=new ActiveXObject ("Microsoft.XMLHTTP");
}
if (xmlhttp!=null)
{
Xmlhttp.onreadystatechange=onresponse;
Xmlhttp.open ("Get", url,true);
Xmlhttp.send (NULL);
}
Else
{
Alert ("Your browser does not support XMLHTTP.");
}
}
function Onresponse ()
{
if (xmlhttp.readystate!=4) return;
if (xmlhttp.status!=200)
{
Alert ("Problem retrieving XML Data");
Return
}
txt= "<table border= ' 1 ' >";
X=xmlhttp.responsexml.documentelement.getelementsbytagname ("CD");
for (i=0;i<x.length;i++)
{
Txt=txt + "<tr>";
Xx=x[i].getelementsbytagname ("TITLE");
{
Try
{
Txt=txt + "<td>" + xx[0].firstchild.nodevalue + "</td>";
}
catch (er)
{
Txt=txt + "<td> </td>";
}
}
Xx=x[i].getelementsbytagname ("ARTIST");
{
Try
{
Txt=txt + "<td>" + xx[0].firstchild.nodevalue + "</td>";
}
catch (er)
{
Txt=txt + "<td> </td>";
}
}
Txt=txt + "</tr>";
}
Txt=txt + "</table>";
document.getElementById (' Copy '). Innerhtml=txt;
}
</script>
<body>
<div id= "Copy" >
<button onclick= "Loadxmldoc (' Cd_catalog.xml ')" >get CD info</button>
</div>
</body>