XML DOM entities attribute

DocumentType object reference manual

Definition and usage

The entities attribute can return a NamedNodeMap containing both external entities and internal entities declared in the DTD.

Syntax:

documentObject.doctype.entities

Example

In all examples, we will use the XML file note_internal_dtd.xml, and JavaScript functions loadXMLDoc().

The following code snippet can display the node names and node types of entities declared in the DTD:

xmlDoc=loadXMLDoc("note_internal_dtd.xml");
var 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 />")
  }

Output:

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

DocumentType object reference manual