Views of Internal Entities
Computer programmers tend to think of internal
entities as macros of zero arguments.
Publishers tend to think of them as "boilerplate".
One of the nice consequences of the rules for
conformance is that every XML
processor in the world is
required to do internal entity processing,
if the entities are declared in the internal subset.
Internal entities are incredibly useful in many situations; here are a few
examples:
- Little chunks of boilerplate text that you're going to be using all
over the place, which it's nice to store and manage in only one place, thus
improving accuracy and saving network bandwidth. For example:
<!ENTITY Copyright ';© 1998, Tim Bray'>
- In URLs; many XML documents contain lots of URLs; as we all know, URLs
tend to move around and are painfully difficult to maintain.
It is really useful to use entities to help make this easier:
<a href='&home;/bin/wr.pl'>.
- Naming Unicode characters; of course, you can refer to them by number,
but it's much nicer to say
<!ENTITY mdash '—'>
Back-link to spec
Copyright © 1998, Tim Bray. All rights reserved.