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 and refer to
that constant from inside the content specification of each element.
Then to add or delete something from all the listings,
you'd only need to change the definition of the
constant.