Revision: 38177
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 28, 2010 07:41 by mavrikicecool
Initial Code
<!--<Developer by shashikanth reddy>-->
<!--<Logic borrowed from other sources through small snippets, and i hgave customized to simple presentation>-->
<html>
<body>
<script type="text/javascript">
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","targetpage.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
document.write("<table border='1' cellpadding='4' cellspacing='4' align='center' frame='box' rules='none' border='1'>");
var x=xmlDoc.getElementsByTagName("employee");
//alert(x.length);
document.write("<td align='center'>Name</td>");
document.write("<td align='center'>Designation</td>");
document.write("<td align='center'>Department</td>");
document.write("<td align='center'>Current Location</td>");
document.write("<td align='center'>Company</td>");
document.write("<td align='center'>Address</td>");
document.write("</td></tr>");
for (i=0;i<x.length;i++)
{
document.write("<tr><td align='center'>");
document.write(x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue);
document.write("</td><td align='center'>");
document.write(x[i].getElementsByTagName("desig")[0].childNodes[0].nodeValue);
document.write("</td><td align='center'>");
document.write(x[i].getElementsByTagName("dept")[0].childNodes[0].nodeValue);
document.write("</td><td align='center'>");
document.write(x[i].getElementsByTagName("currentloc")[0].childNodes[0].nodeValue);
document.write("</td><td align='center'>");
document.write(x[i].getElementsByTagName("company")[0].childNodes[0].nodeValue);
document.write("</td><td align='center'>");
document.write(x[i].getElementsByTagName("address")[0].childNodes[0].nodeValue);
document.write("</td></tr>");
}
document.write("</table>");
</script>
</body>
</html>
--------------****************---------------
<!--xml file targetpage targetpage.php -->
<?xml version="1.0" encoding="iso-8859-1"?>
<shashi>
<employee>
<name>Syed Abdul baqi</name>
<desig>SSE</desig>
<dept>PHP</dept>
<currentloc>Dubai</currentloc>
<company>Bodhtree</company>
<address>Malakpet</address>
</employee>
<employee>
<name>Shashikanth reddy</name>
<desig>JSE</desig>
<dept>PHP</dept>
<currentloc>Hyderabad</currentloc>
<company>Self</company>
<address>Dilsukhnagar</address>
</employee>
<employee>
<name>Raman</name>
<desig>SSE</desig>
<dept>Websphere</dept>
<currentloc>Madurai</currentloc>
<company>Honeywell</company>
<address>Habsiguda</address>
</employee>
<employee>
<name>Sridhar</name>
<desig>SSE</desig>
<dept>PHP</dept>
<currentloc>Hyderabad</currentloc>
<company>Votive</company>
<address>Bhel</address>
</employee>
</shashi>
Initial URL
Initial Description
Initial Title
Simple representation for dumping and showing data into html from a xml file
Initial Tags
file, html, xml
Initial Language
XML