Altova XMLSpy 2024 Professional Edition

About entities

You can define entities for use in Authentic View, whether your document is based on a DTD or an XML Schema. Once defined, these entities are displayed in the Entities Entry Helper and in the Insert Entity submenu of the context menu. When you double-click on an entity in the Entities Entry Helper, that entity is inserted at the cursor insertion point.


An entity is useful if you will be using a text string, XML fragment, or some other external resource in multiple locations in your document. You define the entity, which is basically a short name that stands in for the required data, in the Define Entities dialog. After defining an entity you can use it at multiple locations in your document. This helps you save time and greatly enhances maintenance.


Types of entity

There are two broad types of entityyou can use in your document: a parsed entity, which is XML data (either a text string or a fragment of an XML document), or an unparsed entity, which is non-XML data such as a binary file (usually a graphic, sound, or multimedia object). Each entity has a name and a value. In the case of parsed entities the entity is a placeholder for the XML data. The value of the entity is either the XML data itself or a URI that points to a .xml file that contains the XML data. In the case of unparsed entities, the value of the entity is a URI that points to the non-XML data file.


Defining entities

To define an entity:


1.Click Authentic | Define XML Entities. This opens the Define Entities dialog (screenshot below).


2.Enter the name of your entity in the Name field. This is the name that will appear in the Entities Entry Helper.

3.Enter the type of entity from the drop-down list in the Type field. The following types are possible: An Internal entity is one for which the text to be used is stored in the XML document itself. Selecting PUBLIC or SYSTEM specifies that the resource is located outside the XML file, and will be located with the use of a public identifier or a system identifier, respectively. A system identifier is a URI that gives the location of the resource. A public identifier is a location-independent identifier, which enables some processors to identify the resource. If you specify both a public and system identifier, the public identifier resolves to the system identifier, and the system identifier is used.

4.If you have selected PUBLIC as the Type, enter the public identifier of your resource in the PUBLIC field. If you have selected Internal or SYSTEM as your Type, the PUBLIC field is disabled.

5.In the Value/Path field, you can enter any one of the following:


If the entity type is Internal, enter the text string you want as the value of your entity. Do not enter quotes to delimit the entry. Any quotes that you enter will be treated as part of the text string.

If the entity type is SYSTEM, enter the URI of the resource or select a resource on your local network by using the Browse button. If the resource contains parsed data, it must be an XML file (i.e., it must have a .xml extension). Alternatively, the resource can be a binary file, such as a GIF file.

If the entity type is PUBLIC, you must additionally enter a system identifier in this field.


6.The NDATA entry tells the processor that this entity is not to be parsed but to be sent to the appropriate processor. The NDATA field must therefore contain some value to indicate that the entity is an unparsed entity.


Dialog features

You can do the following in the Define Entities dialog:


Append entities

Insert entities

Delete entities

Sort entities by the alphabetical value of any column by clicking the column header; clicking once sorts in ascending order, twice in descending order.

Resize the dialog box and the width of columns.

Locking. Once an entity is used in the XML document, it is locked and cannot be edited in the Define Entities dialog. Locked entities are indicated by a lock symbol in the first column. Locking an entity ensures that the XML document is valid with respect to entities. (The document would be invalid if an entity is referenced but not defined.)

Duplicate entities are flagged.


Limitations of entities


An entity contained within another entity is not resolved, either in the dialog, Authentic View, or XSLT output, and the ampersand character of such an entity is displayed in its escaped form, i.e. &.

External unparsed entities that are not image files are not resolved in Authentic View. If an image in the design is defined to read an external unparsed entity and has its URI set to be an entity name (for example: 'logo'), then this entity name can be defined in the Define Entities dialog (see screenshot above) as an external unparsed entity with a value that resolves to the URI of the image file (as has been done for the logo entity in the screenshot above).


© 2018-2024 Altova GmbH