Chapter 7. Entities

Table of Contents
7.1. Entity display and entity expansion
7.2. Entity insertion
7.3. Entity defaults
7.4. Declaring new entities

Several types of entities are supported by epcEdit for SGML and XML documents. How entities are handled by epcEdit depends on the type of the entity, the preference settings for epcEdit, and the type of the current document:

In addition to the type of an entity, epcEdit distinguishes between internal and external entities (i.e. between entities that reside in the document or the DTD and entities that reside in an external file) and between entities that are locally defined (i.e. defined within the document prolog) and entities that are defined outside of the document in the DTD.

Entities are used for a variety of purposes in XML and SGML documents, most prominently:

Other uses of entities that are of minor importance include shortref declarations and other markup-related issues.

Strictly speaking, almost everything in SGML or XML is an entity; even a complete XML or SGML document is often referred to as the document entity. In this manual, we take the practical view of talking about documents and entities that may be referenced in a document.

7.1. Entity display and entity expansion

When an entity is referenced in a document, epcEdit decides what to do depending on the type of the entity. For CDATA, SDATA, PI, and NDATA entities, epcEdit inserts a placeholder for the entity (an entity reference) in the document.  Unless the entity has been specially configured, epcEdit will show the entity reference in the same way as it would appear in the text of the SGML or XML document, i.e. epcEdit will show a reference to an entity named X as &X;.

It is possible to tell epcEdit to display an arbitrary string for the entity reference; for example, the entity frac14 (denoting a numerical value of one quarter), can be configured to be displayed as ¼. This facility is commonly used to display a visual clue for the presentation of the referenced entity in print or in online versions of the document.

You can tell epcEdit whether entity replacement strings should be displayed or whether entity references should be shown as entity names. To change the display of entity replacements, follow these steps:

Displaying entity references

  1. Select View from the main menu.

  2. The current display state is reflected by the check marker to the left of the item. If the check mark is present, entity references are always shown as entity names. If the check mark is not visible, entity references are shown as replacement strings if available.

  3. To change the status of the entity display, click on the Entity Names menu item to turn the display of replacements on (if it currently off) or to turn it off if it is currently on.

Things are slightly more complicated for TEXT entities. In SGML documents, TEXT entities are normally used for representing larger text quantities whereas single-character replacements are usually specified by CDATA or SDATA entities. Consequently, it is convenient to show the content of a text entity because it provides content that might be important for the textual structure of a document. A text entity reference for which the content is shown by epcEdit is called an expanded text entity. The content of an expanded text entity is shown by epcEdit between a pair of text entity tags. Because the content of the expanded text entity does not really reside in your document, but in the text entity definition, any alterations to the content of an expanded text entity are normally prohibited by epcEdit (see Entities for editing text entity contents).

In XML documents, only NDATA and TEXT entities are available. NDATA entities refer to data that is not to be interpreted as part of the document text, so TEXT entities are used for single-character replacements and for larger text units. Which text entities should be expanded so that their content is visible and which entities should be displayed as an entity reference?

This problem is solved by epcEdit by letting you specify which TEXT entities should be expanded and which TEXT entities should be displayed as an entity reference only: For each text entity, you can specify whether epcEdit should expand the text entity and display the entity content or whether epcEdit should display an unexpanded entity reference. (Please refer to The entity manager for details.)

Note: Entity expansion occurs when a document is loaded or when an entity is inserted into a document. Changing the expand-status of a text entity will take effect for the next insertion of a reference to that entity or the next time the document is loaded.

epcEdit stores the expand-status of a text entity in the document template. The next time that you open a document, epcEdit will retrieve the expand-status for each entity from the template and apply it to your document.

Tip: We recommend to set the expand-status of text entities that contain markup to Yes and to set the expand status of all other text entities to No.

When a document is loaded or created, epcEdit will initialize the expand- and display-settings of the defined entities to reasonable defaults.