XML DOM doctype గుణం
నిర్వహణ మరియు వినియోగం
doctype
గుణం డాక్యుమెంట్తో సంబంధించిన DocumentType ప్రకటనను అందిస్తుంది.
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; }