包含DTD中聲明的符號的屬性表示法。
示例
檔:notation.xml 的內容如下 -
<?xml version = "1.0"?>
<!DOCTYPE address [
<!ELEMENT address (#PCDATA)>
<!NOTATION name PUBLIC "zaixian">
<!ATTLIST address category NOTATION (name) #REQUIRED>
]>
<address name = "zaixian">Hello zaixian!</address>
以下示例演示了符號屬性的用法 -
<!DOCTYPE html>
<html>
<meta charset="utf-8"/>
<head>
<script>
function loadXMLDoc(filename) {
if (window.XMLHttpRequest) {
xhttp = new XMLHttpRequest();
} else // code for IE5 and IE6
{
xhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.open("GET",filename,false);
xhttp.send();
return xhttp.responseXML;
}
</script>
</head>
<body>
<script>
xmlDoc = loadXMLDoc("/notation.xml");
var notations = xmlDoc.doctype.notations;
document.write("notations: "+notations);
document.write("Item "+notations.getNamedItem('zaixian'));
</script>
</body>
</html>
流覽器不太支持此集合,但沒有其他方法可以檢索此數據。
執行上面示例代碼,得到以下結果 -
上一篇:
DOM DocumentType對象
下一篇:
ProcessingInstruction對象