XML DOM systemId 属性

定义和用法

systemId 属性返回外部 DTD 的系统标识符。

语法

documentObject.doctype.systemId

实例

下面的代码将 "note_external_dtd.xml" 加载到 xmlDoc 中,并显示外部 DTD 的系统 id:

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

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

亲自试一试