- Introduction
- Internal Versus External Entities
- General and Parameter Entities
- Parsed Versus Unparsed Entities
Internal Versus External Entities
In Listing 1, the replacement text of the entity is contained in a string within the <!ENTITY> markup itself. For very short, simple entities this is very convenient. For longer, multiline replacements, storing the entity value in an external file would be more appropriate. The XML entity syntax provides this capability by using the SYSTEM keyword (in place of a string) within the entity declaration, like so:
<!ENTITY wp SYSTEM "war_and_peace.txt">
Within the document, every occurrence of the ℘ entity reference would be replaced by the contents of the file war_and_peace.txt. The XML parser would then continue parsing, beginning with the text that was just included. This means that entity text can, in turn, contain entity references.