TUTORIAL前端与浏览器FETCHED

XML DOM entities 属性

XML DOM entities 属性 DocumentType 对象 定义和用法 entities 属性返回包含有在 DTD 中所声明的外部实体和内部实体的 NamedNodeMap。 语法 documentObject.doctype.entities 实例 下面的代码片段使用 loadXMLDoc() 把 'note_internal_dtd.xml' 载入 xmlDoc 中,并显示在 DTD 中..

更新于 2026/7/16

教程详情页默认 noindex。

XML DOM entities 属性


DocumentType 对象参考手册 DocumentType 对象

定义和用法

entities 属性返回包含有在 DTD 中所声明的外部实体和内部实体的 NamedNodeMap。

语法

documentObject.doctype.entities


实例

下面的代码片段使用 loadXMLDoc() 把 "note_internal_dtd.xml" 载入 xmlDoc 中,并显示在 DTD 中声明过的实体的节点名称和节点类型:

实例

xmlDoc=loadXMLDoc("note_internal_dtd.xml"); x=xmlDoc.doctype.entities; for (i=0;i<x.length;i++) { document.write("Nodename: " + x.item(i).nodeName); document.write("<br>"); document.write("Nodetype: " + x.item(i).nodeType); document.write("<br>"); }

输出:

Nodename: writer
Nodetype: 6
Nodename: copyright
Nodetype: 6

尝试一下 »

DocumentType 对象参考手册 DocumentType 对象