Name
Parsed General Entities
Synopsis
<!ENTITY
name
"
Replacement text
.">
<!ENTITY
name
SYSTEM "
system-literal
">
<!ENTITY
name
PUBLIC "
pubid-literal
" "
system-literal
">
Parsed general entities are declared within the document type definition and then referenced within the document’s text and attribute content. When the document is parsed, the entity’s replacement text is substituted for the entity reference. The parser then resumes parsing, starting with the text that was just replaced.
Parsed general entities are declared within the DTD using a superset of the syntax used to declare parameter entities.
Internal entities store the replacement text inline as a literal string. The replacement text within an internal entity is included completely in the entity declaration itself, obviating the need for an external file to contain the replacement text. This situation closely resembles the string replacement macro facilities found in many popular programming languages and environments:
<!ENTITY
name
"
Replacement text
">
When a parsed general entity is referenced, the contents of the external entity are included in the document, and the XML parser resumes parsing, starting with the newly included text.
Tip
There are actually two types of general entities permitted by the XML Recommendation: parsed and unparsed. An unparsed entity is declared using the same syntax as a general parsed external entity, but with the addition of an XML notation name to the declaration:
<!ENTITY
Get XML in a Nutshell, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.