XML DOM doctype 属性

Document オブジェクトリファレンスマニュアル

定義と用法

doctype 属性は、ドキュメントに関連付けられた文書タイプ宣言(Document Type Declaration)を返します。

DTD がない XML ドキュメントの場合は null を返します。

この属性は DocumentType オブジェクト(Document の子ノード)への直接アクセスを提供します。

構文:

documentObject.doctype

インスタンス

すべての例では、XML ファイルを使用します note_internal_dtd.xml、および JavaScript ファンクション loadXMLDoc()

以下のコードスニペットは DocumentType オブジェクトを返します:

xmlDoc=loadXMLDoc("note_internal_dtd.xml");
document.write(xmlDoc.doctype);

出力:

[object DocumentType]

Document オブジェクトリファレンスマニュアル