XML DOM documentURI 속성
정의와 사용법
documentURI
속성을 설정하거나 문서의 위치를 반환합니다.
문법
documentObject.documentURI
예제
아래 코드는 "books.xml" 파일을 xmlDoc에 로드하고 XML 문서의 위치를 표시합니다:
var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { myFunction(this); } }; xhttp.open("GET", "books.xml", true); xhttp.send(); function myFunction(xml) { var xmlDoc = xml.responseXML; document.getElementById("demo").innerHTML = "Document location: " + xmlDoc.documentURI; }