MICROSOFT DOM MC1803 XML AND WEB SERVICES LAB Anna University lab manual download fifth semester - Computer Programming

Latest

C C++ Java Python Perl Programs Examples with Output -useful for Schools & College Students

Saturday, January 29, 2011

MICROSOFT DOM MC1803 XML AND WEB SERVICES LAB Anna University lab manual download fifth semester

MICROSOFT DOM MC1803 XML AND WEB SERVICES LAB Anna University lab manual download fifth semester


CREATE A DOM DOCUMENT TO RETRIVE INFORMATION FROM  BOOK   XML DOCUMENT

 

<html>
<head>
<script type="text/javascript">
function loadXML()
{
 var xmlDOC=new ActiveXObject("Microsoft.XMLDOM");
xmlDOC.async=false;
xmlDOC.load("bookstore.xml");
var i;
document.write("<html>");
document.write("<body>"); 
document.write("<table>");

document.write("<td>");
var x=xmlDOC.getElementsByTagName("name");
document.write("BOOK NAME");
for(i=0;i<x.length;i++)
{

  document.write("<h5>");   
    document.write(x[i].childNodes[0].nodeValue);
  document.write("</h5>");   

}
document.write("</td>");


document.write("<td>");
var x=xmlDOC.getElementsByTagName("price");
document.write("BOOK PRICE----");
for(i=0;i<x.length;i++)
{
  document.write("<h5>");   
    document.write(x[i].childNodes[0].nodeValue);
  document.write("</h5>");        

}
document.write("</td>");


document.write("<td>");
var x=xmlDOC.getElementsByTagName("no.pages");
document.write("NUMBER OF PAGES");
for(i=0;i<x.length;i++)
{
 
   document.write("<h5>");   
     document.write(x[i].childNodes[0].nodeValue);
   document.write("</h5>"); 

  
}
document.write("</td>");
document.write("</table >");
document.write("</body>");
document.write("</html>");
}
</script>
<body onload="javascript:loadXML()">
</body>
</html>


No comments:

Post a Comment