Creating entities

An entity is a shortcut used to represent complex strings or symbols that would otherwise be impossible, difficult or repetitive to include by hand.

For example, you need to place a copyright notification (for example, Copyright 2004. MyCompany publishing.) at the end of every page of a book. Instead of writing it every time, you could create an entity that represents this text: <!ENTITY copyright "Copyright 2004. MyCompany publishing."> where copyright is the name of the entity and "Copyright 2004. MyCompany publishing" is the text that the copyright entity represents.

To create an entity, follow these steps:

  1. Open your DTD in the DTD editor.
  2. In the Outline view, right-click the DTD This graphic is the DTD icon. and click Add Entity .
  3. In the Properties view, type the new name of the entity in the Name field.
  4. From the Entity Type list, select General or Parameter. General entities are used in XML files, whereas parameter entities are used only in the DTD and do not have any use in an XML file.
  5. Select the External check box if you want to declare your entity as an external entity. An external entity references an external document or data.
  6. If you did make the entity external, the following fields appear:
    • Public ID (Optional). Type the path of the DTD you want to reference. You can then use the resources in the file you are referencing.
    • System ID. Type the path of the external data or document you want to reference, or browse for it. You can then use the resources in the file you are referencing.

    You only need to specify the Public ID or the System ID, not both. If, in your DTD, you want to use any of the resources (such as elements or attributes) contained in the document you have referenced, you must make this entity a Parameter entity, and "expand" the entity by creating an external parameter entity reference (right-click the DTD This graphic is the DTD icon., click Add Parameter Entity Reference, and select the entity you just created).

  7. If you did not make the entity external, you can specify the entity value in the Entity value field.
  8. Click the Documentation tab if you want to provide any information about this entity. The Documentation page is used for human readable material, such as a description of the entity.
The follow links explain different ways you can reuse entities:
Related tasks
Deleting elements, attributes, entities, notations, and comments

Feedback