XML DOM 네임스페이스URI 속성
❮ 속성 개체
예시
다음 코드 조각은 " books_ns.xml "을 xmlDoc에 로드하고 "lang" 속성의 네임스페이스 URI를 반환합니다.
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
myFunction(this);
}
};
xhttp.open("GET",
"books_ns.xml", true);
xhttp.send();
function myFunction(xml) {
var x, i, xmlDoc, txt;
xmlDoc = xml.responseXML;
var txt = "";
x =
xmlDoc.getElementsByTagName("title");
for (i = 0; i <
x.length; i++) {
txt += "Namespace
URI: " + x.item(i).attributes[0].namespaceURI + "<br>";
}
document.getElementById("demo").innerHTML = txt;
}
위 코드의 출력은 다음과 같습니다.
Namespace URI: http://www.w3.org/2000/xmlns/
Namespace URI:
http://www.w3.org/2000/xmlns/
정의 및 사용
namespaceURI 속성은 속성의 네임스페이스 URI를 설정하거나 반환합니다.
통사론
attrObject.namespaceURI
❮ 속성 개체