XML DOM 문서 유형 속성
❮ 문서 객체
예시
다음 코드 조각은 " note_internal_dtd.xml "을 xmlDoc에 로드하고 DocumentType 개체를 반환합니다.
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
myFunction(this);
}
};
xhttp.open("GET", "note_internal_dtd.xml", true);
xhttp.send();
function myFunction(xml) {
var xmlDoc = xml.responseXML;
document.getElementById("demo").innerHTML =
xmlDoc.doctype;
}
산출:
[object DocumentType]
정의 및 사용
doctype 속성은 문서와 관련된 문서 유형 선언을 반환합니다.
DTD가 없는 XML 문서의 경우 null을 반환합니다.
이것은 DocumentType 객체 (이 문서의 자식 노드)에 대한 직접 액세스를 제공합니다.
통사론
documentObject.doctype
❮ 문서 객체