DTDs provide facilities for defining some forms of content as well as document structure. Documents can include this predefined content by reference, allowing schema developers to centralize management of content as well as structure. Typically this approach is used to avoid search-and-replace on content that will be changing, or to include large chunks of 'boilerplate' content within a document.
In the General Entities tab of the Advanced pane, the following types of entities can be defined:
The top pane is used to define internal general entities, while the bottom pane is used to define external general entities and unparsed entities (see Figure A).
Figure A - General Entities tab of the Advanced Pane
Like the other XML Authority panes, the rows begin with a selector button that can be used to select the entire row for cut, copy, paste, and clear operations. If there is an error in the declarations made in a row, the row selector button will turn red. The column between the selector and the entity name will contain a document icon if the declaration has been included from another file. If it came from another file, it cannot be edited, though it can be copied and pasted into the current file.
The name for an entity is entered and displayed in the Name column. (NOTE: Entity names must begin with a letter and may contain numbers, underscores, dashes, and full stops -- typically periods).
Defining an internal general entity requires only the entry of a name and a value, as shown in Figure B. The value must be plain text or well-formed XML - all start tags in the entity must have end tags and vice versa.
Figure B - Internal general entities
Documents using this schema may now include the content defined in the general entity area using entity references, which look like:
&entityName;
The parser strips out the entity references and replaces them with the value of the entity. For example, using the entities described in the figure above,
Our new &productName; (&productNum;) is the finest of its breed.
will become:
Our new Capital 8850 (CXY-8850) is the finest of its breed.
External general entities (see Figure C) work very similarly, except that the value isn't given in the declaration. Instead, a reference to another document is provided, and the contents of the referenced document are used as the value for substitution. Like the value of an internal entity, all markup within the referenced file must be well-formed. Optionally, a public identifier (used in some SGML environments) may be provided. The notation column should be left blank for an external general entity.
Figure C - External general entity
External general entities are referenced from documents the same way that internal general entities are referenced - using the &entityName; syntax. In this case, &play; would reference the XML document 'othello.xml' and include it in a document.
The last kind of entity that can be created in the general entities tab is the unparsed external entities. Unparsed entities reference non-XML content, like graphics files or data. Documents reference unparsed entities through the use of attributes of type ENTITY or ENTITIES. (See data types for more information on these attributes.) To create an unparsed entity, provide the same information as would be provided for an external general entity (name, system identifier, optional public identifier), but also provide a Notation identifying the file type that is being referenced. This notation must be declared on the Notations tab, or XML Authority will mark the declaration as containing an error. The 'myGraphic' unparsed entity shown below in Figure D is an unparsed entity.
Figure D - An unparsed entity (myGraphic)
Copyright 2000 Extensibility, Inc.
Suite 250, 200 Franklin Street, Chapel Hill, North Carolina 27516