Java Reference
In-Depth Information
<!ELEMENT ingredients (ingredient+)>
<!ELEMENT ingredient (#PCDATA)>
<!ELEMENT instructions (#PCDATA)>
<!ATTLIST ingredient qty CDATA "1">
]>
<recipe>
<!-- Child elements removed for brevity. -->
</recipe>
Note
AdocumentcanhaveinternalandexternalDTDs;forexample,
<!DOCTYPE
recipe SYSTEM "http://www.tutortutor.ca/dtds/recipe.dtd" [
<!ELEMENT ...>]>
.TheinternalDTDisreferredtoasthe
internal DTD subset
and
theexternalDTDisreferredtoasthe
external DTD subset
.Neithersubsetcanoverride
the element declarations of the other subset.
You can also declare notations, and general and parameter entities within DTDs. A
notation
isanarbitrarypieceofdatathattypicallydescribestheformatofunparsedbin-
ary data, and typically has the form
<!NOTATION
name
SYSTEM
uri
>
, where
name
identifies the notation and
uri
identifies some kind of plugin that can process
the data on behalf of the application that is parsing the XML document. For example,
<!NOTATION image SYSTEM "psp.exe">
declares a notation named
image
and identifies Windows executable
psp.exe
as a plugin for processing images.
It is also common to use notations to specify binary data types via Internet media
Forexample,
<!NOTATION image SYSTEM "image/jpeg">
declaresan
im-
age
notation that identifies the
image/jpeg
Internet media type for Joint Photo-
graphic Experts Group images.
General entities
are entities referenced from inside an XML document via
general
entity references
,syntacticconstructsoftheform
&
name
;
.Examplesincludethepre-
defined
lt
,
gt
,
amp
,
apos
,and
quot
characterentities,whose
<
,
>
,
&
,
'
,and
"
characterentityreferencesarealiasesforcharacters
<
,
>
,
&
,
'
,
and
"
, respectively.
General entities are classified as internal or external. An
internal general entity
is a
generalentitywhosevalueisstoredintheDTD,andhastheform
<!ENTITY
name
value
>
,where
name
identifiestheentityand
value
specifiesitsvalue.Forexample,
<!ENTITY copyright "Copyright © 2011 Jeff Friesen. All