Quackit Logo
$1.99 Domain Names
With every new non-domain purchase thru ZappyHost, you get a domain name for only $1.99.
Create free Flash websites

DTD Parameter Entities

Print Version

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:

<!ENTITY % name definition>

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

Private:

<!ENTITY % name SYSTEM uri>

Public:

<!ENTITY % name PUBLIC FPI uri>

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.

<!ENTITY % author "<!ELEMENT author EMPTY">
%author;

Enjoy this website?

  1. Add this page to your Favorites
  2. Link to this page (copy/paste into your own website or blog):
  3. Help support Quackit by making a donation

Oh, and thank you for supporting Quackit!

Need Website Content?
Get unique, quality digital content for your website.
  • 270+ Website Templates
  • 800+ Flash Templates
  • 25,000+ Images, Logos
  • 30,000+ e-Books
  • 15,000+ Scripts
  • 27,000+ Animated GIFs
  • 21,000+ Ringtones
  • ...and much more!
Get your content now!
FREE Hosting!
With every domain you register with ZappyHost you get FREE hosting.
© Copyright 2000 - 2010 Quackit.com