Parameter Entities
It is not uncommon for multiple elements to share all or
part of the same attribute lists and content specifications. For
instance, any element that’s a simple XLink will have xlink:type and xlink:href attributes, and perhaps xlink:show and xlink:actuate attributes. In XHTML, a
th element and a td element contain more or less the same
content. Repeating the same content specifications or attribute lists
in multiple element declarations is tedious and error-prone. It’s
entirely possible to add a newly defined child element to the
declaration of some of the elements but forget to include it in
others.
For example, consider an XML application for residential real estate listings that provides separate elements for apartments, sublets, coops for sale, condos for sale, and houses for sale. The element declarations might look like this:
<!ELEMENT apartment (address, footage, rooms, baths, rent)> <!ELEMENT sublet (address, footage, rooms, baths, rent)> <!ELEMENT coop (address, footage, rooms, baths, price)> <!ELEMENT condo (address, footage, rooms, baths, price)> <!ELEMENT house (address, footage, rooms, baths, price)>
There’s a lot of overlap between the declarations, i.e., a lot
of repeated text. And if you later decide you need to add an
additional element, available_date for instance, then you need to add it to all five declarations. It would be preferable to define a constant that can hold the common parts of the content specification for all five kinds of listings ...