<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">

<HTML>
  <HEAD>
    <TITLE>Loadxml</TITLE>
  </HEAD>
  
  <BODY ONLOAD="Parse()">

   <SCRIPT>

   function Parse()
   {

    // Create a Document object and report the results.
    // The following instantiate  different versions of the MSXML parser
    // Version 1  ProgID: Microsoft.XMLDOM
    // Version 2  ProgID: MSXML2.DOMDocument
    // Version 3  ProgID: MSXML2.DOMDocument.3.0

//    var xmlDocument = new ActiveXObject("Microsoft.XMLDOM");
    var xmlDocument = new ActiveXObject("MSXML2.DOMDocument");
    var cloneDocument = new ActiveXObject("MSXML2.DOMDocument");
//    var xmlDocument = new ActiveXObject("MSXML2.DOMDocument.3.0");

    xmlDocument.load("news.xml");

    var docRoot = xmlDocument.documentElement;
    if (docRoot == null)
       alert("Document is null"); 

    else {
    
       // Test the cloneNode method

       if (xmlDocument.documentElement.hasChildNodes) 
       {
          var cloneTree = xmlDocument.documentElement.firstChild.cloneNode(true);
          cloneDocument.documentElement = xmlDocument.documentElement;
          cloneDocument.documentElement.insertBefore(cloneTree, 
               cloneDocument.documentElement.firstChild);
       }
       // Depending upon permissions, this call may or may not work. If
       // you receive a file permissions error, 
       // rename this file with a .hta
       // file extension aand rerun.
       cloneDocument.save("test4.xml");
       alert("Document Saved in test4.xml");

    } // else
   } // Parse
   </SCRIPT> 
    
  </BODY>
</HTML>