Entity
Stay organized with collections
Save and categorize content based on your preferences.
This interface represents a known entity, either parsed or unparsed, in an
XML document. Note that this models the entity itself not the entity declaration.
The nodeName
attribute that is inherited from
Node
contains the name of the entity.
An XML processor may choose to completely expand entities before the
structure model is passed to the DOM; in this case there will be no
EntityReference
nodes in the document tree.
XML does not mandate that a non-validating XML processor read and
process entity declarations made in the external subset or declared in
parameter entities. This means that parsed entities declared in the
external subset need not be expanded by some classes of applications, and
that the replacement text of the entity may not be available. When the
replacement text is available, the corresponding Entity
node's child list
represents the structure of that replacement value. Otherwise, the child
list is empty.
DOM Level 3 does not support editing Entity
nodes; if a
user wants to make changes to the contents of an Entity
,
every related EntityReference
node has to be replaced in the
structure model by a clone of the Entity
's contents, and
then the desired changes must be made to each of those clones instead.
Entity
nodes and all their descendants are readonly.
An Entity
node does not have any parent.
Note: If the entity contains an unbound namespace prefix, the
namespaceURI
of the corresponding node in the
Entity
node subtree is null
. The same is true
for EntityReference
nodes that refer to this entity, when
they are created using the createEntityReference
method of
the Document
interface.
See also the Document Object Model (DOM) Level 3 Core Specification.
Inherited Constant Summary
Public Method Summary
abstract
String
|
getInputEncoding()
An attribute specifying the encoding used for this entity at the time
of parsing, when it is an external parsed entity.
|
abstract
String
|
getNotationName()
For unparsed entities, the name of the notation for the entity.
|
abstract
String
|
getPublicId()
The public identifier associated with the entity if specified, and
null otherwise.
|
abstract
String
|
getSystemId()
The system identifier associated with the entity if specified, and
null otherwise.
|
abstract
String
|
getXmlEncoding()
An attribute specifying, as part of the text declaration, the encoding
of this entity, when it is an external parsed entity.
|
abstract
String
|
getXmlVersion()
An attribute specifying, as part of the text declaration, the version
number of this entity, when it is an external parsed entity.
|
Inherited Method Summary
From interface
org.w3c.dom.Node
abstract
Node
|
appendChild( Node newChild)
Adds the node newChild to the end of the list of children
of this node.
|
abstract
Node
|
cloneNode(boolean deep)
Returns a duplicate of this node, i.e., serves as a generic copy
constructor for nodes.
|
abstract
short
|
|
abstract
NamedNodeMap
|
getAttributes()
A NamedNodeMap containing the attributes of this node (if
it is an Element ) or null otherwise.
|
abstract
String
|
getBaseURI()
The absolute base URI of this node or null if the
implementation wasn't able to obtain an absolute URI.
|
abstract
NodeList
|
getChildNodes()
A NodeList that contains all children of this node.
|
abstract
Object
|
getFeature( String feature, String version)
This method returns a specialized object which implements the
specialized APIs of the specified feature and version, as specified
in .
|
abstract
Node
|
|
abstract
Node
|
|
abstract
String
|
getLocalName()
Returns the local part of the qualified name of this node.
|
abstract
String
|
getNamespaceURI()
The namespace URI of this node, or null if it is
unspecified (see ).
|
abstract
Node
|
|
abstract
String
|
getNodeName()
The name of this node, depending on its type; see the table above.
|
abstract
short
|
getNodeType()
A code representing the type of the underlying object, as defined above.
|
abstract
String
|
getNodeValue()
The value of this node, depending on its type; see the table above.
|
abstract
Document
|
|
abstract
Node
|
|
abstract
String
|
getPrefix()
The namespace prefix of this node, or null if it is
unspecified.
|
abstract
Node
|
|
abstract
String
|
getTextContent()
This attribute returns the text content of this node and its
descendants.
|
abstract
Object
|
|
abstract
boolean
|
hasAttributes()
Returns whether this node (if it is an element) has any attributes.
|
abstract
boolean
|
|
abstract
Node
|
insertBefore( Node newChild, Node refChild)
Inserts the node newChild before the existing child node
refChild .
|
abstract
boolean
|
isDefaultNamespace( String namespaceURI)
This method checks if the specified namespaceURI is the
default namespace or not.
|
abstract
boolean
|
|
abstract
boolean
|
isSameNode( Node other)
Returns whether this node is the same node as the given one.
|
abstract
boolean
|
isSupported( String feature, String version)
Tests whether the DOM implementation implements a specific feature and
that feature is supported by this node, as specified in .
|
abstract
String
|
|
abstract
String
|
lookupPrefix( String namespaceURI)
Look up the prefix associated to the given namespace URI, starting from
this node.
|
abstract
void
|
normalize()
Puts all Text nodes in the full depth of the sub-tree
underneath this Node , including attribute nodes, into a
"normal" form where only structure (e.g., elements, comments,
processing instructions, CDATA sections, and entity references)
separates Text nodes, i.e., there are neither adjacent
Text nodes nor empty Text nodes.
|
abstract
Node
|
removeChild( Node oldChild)
Removes the child node indicated by oldChild from the list
of children, and returns it.
|
abstract
Node
|
replaceChild( Node newChild, Node oldChild)
Replaces the child node oldChild with newChild
in the list of children, and returns the oldChild node.
|
abstract
void
|
setNodeValue( String nodeValue)
The value of this node, depending on its type; see the table above.
|
abstract
void
|
setPrefix( String prefix)
The namespace prefix of this node, or null if it is
unspecified.
|
abstract
void
|
setTextContent( String textContent)
This attribute returns the text content of this node and its
descendants.
|
abstract
Object
|
|
Public Methods
An attribute specifying the encoding used for this entity at the time
of parsing, when it is an external parsed entity. This is
null
if it an entity from the internal subset or if it
is not known.
public
abstract
String
getNotationName
()
For unparsed entities, the name of the notation for the entity. For
parsed entities, this is null
.
public
abstract
String
getPublicId
()
The public identifier associated with the entity if specified, and
null
otherwise.
public
abstract
String
getSystemId
()
The system identifier associated with the entity if specified, and
null
otherwise. This may be an absolute URI or not.
public
abstract
String
getXmlEncoding
()
An attribute specifying, as part of the text declaration, the encoding
of this entity, when it is an external parsed entity. This is
null
otherwise.
public
abstract
String
getXmlVersion
()
An attribute specifying, as part of the text declaration, the version
number of this entity, when it is an external parsed entity. This is
null
otherwise.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["The `Entity` interface in the Document Object Model (DOM) represents a known entity, either parsed or unparsed, within an XML document, modeling the entity itself and not the entity declaration."],["An XML processor might expand entities before the DOM receives the structure model, potentially resulting in no `EntityReference` nodes in the document tree."],["`Entity` nodes and their descendants are read-only, requiring changes to be made by replacing related `EntityReference` nodes with clones of the `Entity` content and modifying those clones."],["This interface provides methods to retrieve information about the entity, such as its public and system identifiers, notation name (for unparsed entities), and encoding information (for external parsed entities)."]]],["The `Entity` interface represents a known entity in an XML document, storing the entity itself, not its declaration. Its `nodeName` attribute contains the entity's name. If available, the child list represents the replacement value. Editing `Entity` nodes is unsupported; changes require cloning and modifying `EntityReference` nodes. `Entity` nodes lack a parent and are read-only. Relevant information, like public and system identifiers, input and XML encodings, version, and notation names, can be retrieved.\n"]]