DTD Parameter Entities
This article provides an overview of DTD parameter entity references.
In the previous lesson we created a General Entity Reference. There is also another type of entity known as a Parameter Entity Reference. This is an entity that is used within the DTD itself. In other words, you can create an entity that can be used within your DTD declarations themselves.
Syntax
When creating a parameter entity, you need to insert a percentage sign (%
) between ENTITY
, and the name of the entity:
You can also declare external parameter entities. You do this using the following syntax:
Private:
Public:
Example
Here's an example of an internal parameter entity. In this example, the second line is the actual declaration for the author
element.
This is quite a simplistic example. In reality, you would use parameter entities to represent text that you need to repeat many times within your DTD.
For example, multiple elements might share the same text in their declarations. In this case, a parameter reference could be used instead of repeating the same text.