Quackit Logo
HTML
CSS
Scripting
Database
Hosting
Design
XML
IMCreator - Free Website Builder

DTD Parameter Entities

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:

Code

You can also declare external parameter entities. You do this using the following syntax:

Private:

Code

Public:

Code

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.

Code

Enjoy this page?

  1. Link to this page (copy/paste into your own website or blog):
  2. Link to Quackit using one of these banner ads.

Thanks for supporting Quackit!