Dom-entity-notationname

提供:Dev Guides
移動先:案内検索

DOM-エンティティオブジェクト属性-notationName

属性_notationName_は、解析されていないエンティティの表記法と値の名前を提供します。 解析されたエンティティの場合、値はnullです。

構文

以下は、_notationName_属性を使用するための構文です。

----------

_notation.xml_の内容は以下のとおりです-

<?xml version="1.0"?>
<!DOCTYPE address [
   <!ELEMENT address (#PCDATA)>
   <!NOTATION name PUBLIC "Tanmay">
   <!ATTLIST address category NOTATION (name) #REQUIRED>
]>

<address name = "Tanmay">Hello world!!!!!!</address>

次の例は、_notationName_属性の使用方法を示しています-

<!DOCTYPE html>
<html>
   <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("/dom/notation.xml");

         x = xmlDoc.getElementsByTagName('address');
         document.write("Name of the attribute notation is : ")
         document.write(x.item(0).attributes[0].nodeName);
         document.write("<br>")
         document.write("Value of the attribute notation is : ");
         document.write(x.item(0).attributes[0].nodeValue);
      </script>
   </body>
</html>

実行

このファイルを_entityattribute_notations_としてサーバーパスに保存します(このファイルとnotation.xmlはサーバーの同じパスにある必要があります)。 次のように出力を取得します-

Name of the attribute notation is : name
Value of the attribute notation is : Tanmay