XML DOM implementation 属性

定义和用法

implementation 属性返回处理文档的 DOMImplementation 对象。

语法

documentObject.implementation

实例

下面的代码将 "books.xml" 加载到 xmlDoc 中,并返回处理该文档的 DOMImplementation 对象:

var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
   if (this.readyState == 4 && this.status == 200) {
       myFunction(this);
   }
};
xhttp.open("GET", "books.xml", true);
xhttp.send();

function myFunction(xml) {
    var xmlDoc = xml.responseXML;
    document.getElementById("demo").innerHTML =
    xmlDoc.implementation;
}

亲自试一试