Name
EntityReference
Synopsis
This interface represents a reference from an
XML document to an entity defined in the document’s
DTD. Character entities and predefined entities such as
<
are always expanded in XML documents and
do not create EntityReference
nodes. Note also
that some XML parsers expand all entity references. Documents created
by such parsers do not contain EntityReference
nodes.
This interface defines no methods of its own. The
getNodeName( )
method of the
Node
interface provides the name of the referenced
entity. The getEntities( )
method of the
DocumentType
interface provides a way to look up
the Entity
object associated with that name. Note
however, that the DocumentType
may not contain an
Entity
with the specified name (because, for
example, nonvalidating XML parsers are not required to parse the
external subset of the DTD.) In this case, the
EntityReference
is a reference to a named entity
whose content is not known, and it has no children. On the other
hand, if the DocumentType
does contain an
Entity
node with the specified name, then the
child nodes of the EntityReference
are a copy of
the child nodes of the Entity
, and represent the
expansion of the entity. (The children of an
EntityReference
may not be an exact copy of the
children of an Entity
if the
entity’s expansion includes namespace prefixes that
are not bound to namespace URIs.)
Like Entity
nodes,
EntityReference
nodes and their descendants are
read-only and cannot be edited or modified.
Figure 21-11. org.w3c.dom.EntityReference ...
Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.