PROPERTY:  DocumentType::entities


The entities property contains a NamedNodeMap of all entities (both internal and external) declared in the Document Type Definition. Duplicates are ignored.

In the example that follows the 'staff.xml' file is used which contains a couple of entities defined in the DOCTYPE declaration:

<!DOCTYPE staff SYSTEM "staff.dtd" [
   <!ENTITY snrex "senior executive">
   <!ENTITY pa "personal assistant">

   <employee ssn="123456" pay="3">
      <name>John Sullivan</name>
   <employee ssn="987654" pay="2">
      <name>Mary Lopez</name>

The code above represents the raw XML; when viewed in a browser both of the entities '&snrex;' and '&pa;' will be expanded to the values defined for them in the DOCTYPE declaration (i.e. 'senior executive' and 'personal assistant' respectively).

The code then gets a DocumentType object for this document, and produces a NamedNodeMap of all its entities. It then iterates through the list displaying the name and text of each.

Code (VBScript):
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False

Set DocType = objXMLDoc.doctype
Set EntList = DocType.entities
For Each Ent In EntList
   document.write(": " & Ent.text & "<br>")

snrex: senior executive
pa: personal assistant

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information