<!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 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 NamedNodeMap interface. var attrNodeFromItem = docRoot.firstChild.attributes. item(0).nodeValue; var attrNodeFromGet = docRoot.firstChild.attributes. getNamedItem("section").nodeValue; alert("attr name from item: " + attrNodeFromItem + "\nattr name from get: " + attrNodeFromGet); var attr = docRoot.firstChild.attributes. removeNamedItem("section"); // 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 and rerun. xmlDocument.save("test5.xml"); } // else } // Parse </SCRIPT> </BODY> </HTML>