<html>
<head>
<title>Parsed General Entities</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div id="Description">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="NAME">Parsed General Entities</td>
<td valign="top" class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td valign="top" colspan="2" class="description">
<span class="PROGRAMLISTING"><pre><strong class="userinput">&lt;!ENTITY</strong> <var class="replaceable">name</var> <strong class="userinput">"</strong><var class="replaceable">Replacement text</var><strong class="userinput">."&gt;</strong>
<strong class="userinput">&lt;!ENTITY </strong><var class="replaceable">name</var> <strong class="userinput">SYSTEM "</strong><var class="replaceable">system-literal</var><strong class="userinput">"&gt;</strong>
<strong class="userinput">&lt;!ENTITY </strong><var class="replaceable">name</var> <strong class="userinput">PUBLIC "</strong><var class="replaceable">pubid-literal</var><strong class="userinput">" "</strong><var class="replaceable">system-literal</var><strong class="userinput">"&gt;</strong></pre></span>
<p>
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.</p>

<p>Parsed general entities are declared
within the DTD using a superset of the syntax used to declare
parameter entities.</p>

<p>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:</p>

<span class="PROGRAMLISTING"><pre><strong class="userinput">&lt;!ENTITY </strong><var class="replaceable">name </var><strong class="userinput">"</strong><var class="replaceable">Replacement text</var><strong class="userinput">"&gt;</strong></pre></span>


<p>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.</p>

<tip id="xmlnut3-CHP-21-NOTE-137" role="ora">
<p>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:</p>

<span class="PROGRAMLISTING"><pre>
<strong class="userinput">&lt;!ENTITY</strong><strong class="userinput"> </strong><var class="replaceable">name</var> <strong class="userinput">SYSTEM "</strong><var class="replaceable">system-literal</var><strong class="userinput">"</strong> <var class="replaceable">notation-name</var><strong class="userinput">&gt;</strong>
<strong class="userinput">&lt;!ENTITY</strong><strong class="userinput"> </strong><var class="replaceable">name</var> <strong class="userinput">PUBLIC "</strong><var class="replaceable">pubid-literal</var><strong class="userinput">" "</strong><var class="replaceable">system-literal</var><strong class="userinput">"</strong>
<var class="replaceable">notation-name</var><strong class="userinput">&gt;</strong></pre></span>

<p>Unparsed general entities are not referenced using the
<span class="LITERAL">&amp;</span><var class="replaceable">name</var><span class="LITERAL">;</span>
syntax. To reference unparsed external entities, it is necessary to
declare an attribute using the attribute type
<span class="LITERAL">ENTITY</span>  or <span class="LITERAL">ENTITIES</span>.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).</p>
</tip>
</td></tr>
</table>
</div>
</body>
</html>