एक्सएमएल डोम 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;
}
आउटपुट:
[object DocumentType]
परिभाषा और उपयोग
doctype गुण दस्तावेज़ से संबद्ध दस्तावेज़ प्रकार घोषणा लौटाता है।
डीटीडी के बिना एक्सएमएल दस्तावेज़ों के लिए यह शून्य हो जाता है।
यह DocumentType ऑब्जेक्ट (इस दस्तावेज़ का एक चाइल्ड नोड) तक सीधी पहुँच प्रदान करता है ।
वाक्य - विन्यास
documentObject.doctype
दस्तावेज़ वस्तु