Java Reference
In-Depth Information
Type
Contents
CDATA
Character data.
Enumerated
A list of possible values, one of which is chosen, e.g., (Hardcover | Paperback).
ID
A named attribute. Must be unique in the DTD.
IDREF
A reference to a named ID.
E NTITIES
An XML document can define its own constants or entities. These are named stor-
age units (portions of valid XML content), defined and used by a document. An en-
tity can contain character strings, markup commands, or even references to
external documents. Here are two entities as declared in the sample DTD:
<!ENTITY HARDCOVER "Hardcover">
<!ENTITY PAPERBACK "Paperback">
After they are declared, entities can be used in any appropriate place in the
XML document. In the sample document, you can use the entity (by name, with an
ampersand as a prefix and a semicolon as a suffix) in place of the text represented
by the entity. Consequently, both of these constructs are valid:
<BookType>&PAPERBACK;</BookType>
<BookType>"Paperback"</BookType>
In many ways, entities are similar to Level 88 items in a COBOL program. En-
tities are often used for XML content that is frequently reproduced in the document
(an internal entity), or that is defined externally, and may vary with each instance
of the document type (an external entity). External entities can be defined as pub-
lic, that is, widely used (PUBLIC), or they can be more private, intended to be used
by a small set of XML authors (SYSTEM).
<!ENTITY name SYSTEM "URI">
<!ENTITY name PUBLIC "public_ID" "URI">
DTD's also provide parameter entities, which can also be internal or external.
Parameter entities define some notation sequence in a single place, and then let you
use that definition repeatedly, instead of having to retype the notation sequence
each time.
 
Search WWH ::




Custom Search