Thuộc tính systemId của XML DOM

Định nghĩa và cách sử dụng

systemId Thuộc tính trả về hệ id của DTD外部.

Ngữ pháp

documentObject.doctype.systemId

Mô hình

Dưới đây là mã để tải "note_external_dtd.xml" vào xmlDoc và hiển thị hệ id của DTD外部:

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;
}

Thử trực tiếp