XML DOM doctype 속성
정의와 사용법
doctype
속성은 문서와 연관된 문서 타입 선언을 반환합니다.
DTD가 없는 XML 문서에서는 이 속성이 null을 반환합니다.
이는 DocumentType 객체에 대한 직접 접근을 제공합니다.
문법
documentObject.doctype
예제
아래 코드는 "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; {}