Java Reference
In-Depth Information
rights reserved.">
declaresaninternalgeneralentitynamed
copyright
.The
value of this entity may include another declared entity, such as
©
(the HTML
entityforthecopyrightsymbol),andcanbereferencedfromanywhereinanXMLdoc-
ument by specifying
©right;
.
An
external general entity
isageneralentitywhosevalueisstoredoutsidetheDTD.
Thevaluemightbetextualdata(suchasanXMLdocument),oritmightbebinarydata
(suchasaJPEGimage).Externalgeneralentitiesareclassifiedasexternalparsedgen-
eral entity and external unparsed entity.
An
external parsed general entity
references an external file that stores the entity's
textual data, which is subject to being inserted into a document and parsed by a val-
idating parserwhenageneral entity reference isspecified inthedocument, andwhich
has the form
<!ENTITY
name
SYSTEM
uri
>
, where
name
identifies the entity
and
uri
identifies the external file. For example,
<!ENTITY chapter-header
SYSTEM "http://www.tutortutor.ca/entities/chapheader.xml">
identifies
chapheader.xml
asstoringtheXMLcontenttobeinsertedintoanXML
document wherever
&chapter-header;
appears in the document. The alternative
<!ENTITY
name
PUBLIC
fpi uri
>
form can be specified.
Caution
Becausethecontentsofanexternalfilemaybeparsed,thiscontentmust
be well formed.
An
external unparsed entity
referencesanexternalfilethatstorestheentity'sbinary
data,andhastheform
<!ENTITY
name
SYSTEM
uri
NDATA
nname
>
,where
name
identifiestheentity,
uri
locatestheexternalfile,and
NDATA
identifiesthenota-
tiondeclarationnamed
nname
.Thenotationtypicallyidentifiesapluginforprocessing
thebinarydataortheInternetmediatypeofthisdata.Forexample,
<!ENTITY photo
SYSTEM "photo.jpg" NDATA image>
associates name
photo
with extern-
al binary file
photo.png
and notation
image
. The alternative
<!ENTITY
name
PUBLIC
fpi uri
NDATA
nname
>
form can be specified.
Note
XMLdoesnotallowreferencestoexternalgeneralentitiestoappearinattrib-
ute values. For example, you cannot specify
&chapter-header;
in an attribute's
value.
Parameter entities
areentitiesreferencedfrominsideaDTDvia
parameter entity ref-
erences
,syntacticconstructsoftheform
%
name
;
.Theyareusefulforeliminatingrepet-
itivecontentfromelementdeclarations.Forexample,youarecreatingaDTDforalarge
company, and this DTD contains three element declarations:
<!ELEMENT sales-