7.2. Entity insertion

Entity references can be inserted by two ways into a document: By explicitly inserting an entity reference using the entity manager or by binding an entity to a character.

7.2.1. Inserting entities with the entity manager

The entity dialog contains a list of all entities that are available in your document. To display the entity dialog and to insert an entity reference into your document, follow these steps:

  1. Position the insertion cursor at the location where you want to insert the entity reference.

  2. Select Entities->Entity Manager from the main menu. The entity dialog will appear:

  3. Choose the entity from the list in the entity dialog. You can speed up entity selection by typing the first character of the entity name to scroll to the first entity that begins with this character.

  4. Click on the Insert button to insert a reference to the selected entity.

  5. When you have finished inserting entity references, click on the Close button to dismiss the entity dialog.

Not all entities can be inserted at every location in your document. It is not possible to insert an entity before or after the start tag of your document or at a location where the entity can not occur.

If an entity should be inserted at a location where only element content is allowed, the entity must be a TEXT entity that should be expanded and the content of the text entity must be allowed to occur at the location of th entity reference. epcEdit will not insert references to unexpanded text entities or other entities at locations where data is not allowed.

If a reference to a TEXT entity should be inserted and this text entity should be expanded, then epcEdit will check whether the entity content is allowed to occur at the location of the entity reference. If the entity should not be expanded, epcEdit will treat the entity reference as an opaque data object without checking whether the entity content is allowed at the insertion location.

Tip: The entity manager is a modeless dialog. If you want to insert more than one entity reference, you can leave the entity dialog open to insert entities at different locations of your document.

7.2.2. Automatic entity insertion

You can tell epcEdit to insert a reference to a an entity whenever a specific character key is pressed: For example, the < character is normally represented by the lt entity to avoid the interpretation of < as the start of an XML/SGML tag. Because you normally want to type the < key instead of selecting the lt entity from the entity dialog, you will tell epcEdit to insert an appropriate entity reference automatically. You do this by binding the lt entity to the < key so that epcEdit will insert a reference to the lt entity whenever the < key is pressed. See Entity defaults for details.

Automatic entity insertion is controlled by the setting of the Auto Insert option in the entity menu. If this option is set, entity references will be inserted automatically. If this option is off, entity references can only be inserted by using the entity dialog.

To change the value of the Auto Insert option, follow these steps:

Enabling and disabling automatic entity insertion

  1. Select Entities from the main menu.

  2. The current state of the Auto Insert option is reflected by the check mark to the left of the Auto Insert item. If entity references are automatically inserted, the check-mark is present. If no check mark is shown to the left of the menu item, entity references are not automatically inserted.

  3. Click on the Auto Insert menu item to turn the auto-insert feature off (if is currently enabled) or to turn it on if it is currently disabled.

Even if the auto-insert feature is on, it depends on the exact location of the insertion cursor whether epcEdit will insert an entity reference or not. If the insertion occurs at a location where an entity reference would not be recognized (e.g within a CDATA marked section), epcEdit will insert the original character instead of an entity reference.