Using the DOM to Reach External XML files in IE 5.0


HTML File:

<html>
<head>
<title>
DOM External File Example
</title>
</head>
<body>
<table>
<thead>
<tr>
  <th>Author</th>
  <th>Title</th>
  <th>Pub Date</th>
  <th>Publisher</th>
  <th>ISBN</th>
  <th>Price</th>
</tr>
</thead>
<tbody>
<script>

var nodeCatalog=new ActiveXObject("microsoft.XMLDOM");
nodeCatalog.async=false;
nodeCatalog.load("books.xml");
booksNodeList=nodeCatalog.getElementsByTagName("book");
entries=booksNodeList.length;
for (i=0; i<entries; i++) {
  bookNode=booksNodeList.item(i);

  document.write("<tr>");
  childNode=bookNode.firstChild;
  for (j=0; j<6; j++) {
    document.write("<td>");
    valueNode=childNode.firstChild;
    document.write(valueNode.nodeValue);
    document.write("</td>");
    childNode=childNode.nextSibling;
  }
document.write("</tr>");
}
</script>
</tbody>
</table>
</body>
</html>

Test it

Test a different version with an external island

<Origin Page   TOC

Copyright 2000 Simon St.Laurent