Parsed General Entities | |
<!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. 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 name SYSTEM "system-literal" notation-name> <!ENTITY name PUBLIC "pubid-literal" "system-literal" notation-name> Unparsed general entities are not referenced using the &name; syntax. To reference unparsed external entities, it is necessary to declare an attribute using the attribute type ENTITY or ENTITIES.Unparsed external general entities are one of the features of XML that is poorly understood, poorly supported, and not generally used in practice. It is our recommendation that alternative mechanisms be used to reference external non-XML data (such as XLinks or simple URI strings). |