External Entities

Recall that when an entity is used, it's a substitution. The entity is essentially a placeholder, being replaced by the assigned value when the processing is done.

The ENTITY keyword can also be applied to an external binary item, such as an image file, and is still a type of substitution. However, it's no longer a simple one because the file cannot be placed directly into the reference location. The system needs to be told which program should be used to display the file's contents.

Suppose that the image file MyImage.gif is to be included in your DTD. Since it cannot be directly viewed, something else must be used to display it. In the following line, IMAGE1 is the name of the ENTITY, so you can use it in your files as a ...

Get Sams Teach Yourself XML in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.