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:
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).
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.