# 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 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 , 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:

> Reusing internal parameter entities in an attribute name or type
> Reusing parameter entities in attributes can save you a lot of time. If you have several elements using the exact same attribute, you only have to input the information once (into an entity).
> Reusing the value of one entity in another entity
> Reusing the value of an entity in another entity can save you time in several ways. For example, if your value is long and complicated, it is much faster to simply reuse an entity than manually type in your value each time. As well, if the value changes, you only have to change it in one location.
> Reusing external parameter entities in an element's content model
> Using an entity in a content model can save you time if you want to have the same information in several content models. You can create a DTD that references another DTD and then declares an element whose content model refers to a parameter entity created in another DTD.

Parent topic: Editing DTDs

Related tasks
Deleting elements, attributes, entities, notations, and comments

(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.