Top Description Fields Constructors Methods
com.sun.org.apache.xerces.internal.dom

public Class EntityImpl

extends ParentNode
implements Entity
Class Inheritance
All Implemented Interfaces
org.w3c.dom.Entity, org.w3c.dom.Node
Known Direct Subclasses
com.sun.org.apache.xerces.internal.dom.DeferredEntityImpl
Imports
org.w3c.dom.Entity, .Node, .DOMException

Entity nodes hold the reference data for an XML Entity -- either parsed or unparsed. The nodeName (inherited from Node) will contain the name (if any) of the Entity. Its data will be contained in the Entity's children, in exactly the structure which an EntityReference to this name will present within the document's body.

Note that this object models the actual entity, _not_ the entity declaration or the entity reference.

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 EntityReferences in the DOM tree.

Quoting the 10/01 DOM Proposal,

"The DOM Level 1 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. All the descendants of an Entity node are readonly."
I'm interpreting this as: It is the parser's responsibilty to call the non-DOM operation setReadOnly(true,true) after it constructs the Entity. Since the DOM explicitly decided not to deal with this, _any_ answer will involve a non-DOM operation, and this is the simplest solution.
Author
Elena Litani, IBM
Since
PR-DOM-Level-1-19980818.

Field Summary

Modifier and TypeField and Description
protected String
baseURI

base uri

protected String
encoding

Encoding

protected String
inputEncoding

Input Encoding

protected String
name

Entity name.

protected String
notationName

Notation name.

protected String
publicId

Public identifier.

pack-priv static final long
protected String
systemId

System identifier.

protected String
version

Version

Inherited from com.sun.org.apache.xerces.internal.dom.ParentNode:
firstChildfNodeListCacheownerDocument

Constructor Summary

AccessConstructor and Description
public
EntityImpl(CoreDocumentImpl ownerDoc, String name)

Factory constructor.

Method Summary

Modifier and TypeMethod and Description
public Node
cloneNode(boolean
If true, recursively clone the subtree under the specified node; if false, clone only the node itself (and its attributes, if it is an Element).
deep
)

Overrides com.sun.org.apache.xerces.internal.dom.ParentNode.cloneNode.

Implements org.w3c.dom.Node.cloneNode.

Clone node.

public String

Returns:

The absolute base URI of this node or null.
getBaseURI
()

Overrides com.sun.org.apache.xerces.internal.dom.NodeImpl.getBaseURI.

Implements org.w3c.dom.Node.getBaseURI.

Returns the absolute base URI of this node or null if the implementation wasn't able to obtain an absolute URI.

public String
getInputEncoding()

Implements org.w3c.dom.Entity.getInputEncoding.

An attribute specifying the encoding used for this entity at the tiome of parsing, when it is an external parsed entity.

public String
public short
getNodeType()

Implements abstract com.sun.org.apache.xerces.internal.dom.NodeImpl.getNodeType.

Implements org.w3c.dom.Node.getNodeType.

A short integer indicating what type of node this is.

public String
getNotationName()

Implements org.w3c.dom.Entity.getNotationName.

Unparsed entities -- which contain non-XML data -- have a "notation name" which tells applications how to deal with them.

public String
getPublicId()

Implements org.w3c.dom.Entity.getPublicId.

The public identifier associated with the entity.

public String
getSystemId()

Implements org.w3c.dom.Entity.getSystemId.

The system identifier associated with the entity.

public String
getXmlEncoding()

Implements org.w3c.dom.Entity.getXmlEncoding.

DOM Level 3 WD - experimental the encoding of this entity, when it is an external parsed entity.

public String
getXmlVersion()

Implements org.w3c.dom.Entity.getXmlVersion.

DOM Level 3 WD - experimental the version number of this entity, when it is an external parsed entity.

public void
setBaseURI(String uri)

NON-DOM: set base uri

public void
setInputEncoding(String inputEncoding)

NON-DOM, used to set the input encoding.

public void
public void
setNotationName(String name)

DOM Level 2: Unparsed entities -- which contain non-XML data -- have a "notation name" which tells applications how to deal with them.

public void
setPrefix(String prefix)

Overrides com.sun.org.apache.xerces.internal.dom.NodeImpl.setPrefix.

Implements org.w3c.dom.Node.setPrefix.

The namespace prefix of this node

public void
setPublicId(String id)

DOM Level 2: The public identifier associated with the entity.

public void
setSystemId(String id)

DOM Level 2: The system identifier associated with the entity.

public void
setXmlEncoding(String value)

NON-DOM encoding - An attribute specifying, as part of the text declaration, the encoding of this entity, when it is an external parsed entity.

public void
setXmlVersion(String value)

NON-DOM version - An attribute specifying, as part of the text declaration, the version number of this entity, when it is an external parsed entity.

Inherited from com.sun.org.apache.xerces.internal.dom.ParentNode:
checkNormalizationAfterInsertcheckNormalizationAfterRemovegetChildNodesgetChildNodesUnoptimizedgetFirstChildgetLastChildgetLengthgetOwnerDocumentgetTextContentgetTextContenthasChildNodeshasTextContentinsertBeforeinternalInsertBeforeinternalRemoveChildisEqualNodeitemlastChildlastChildnormalizeownerDocumentremoveChildreplaceChildsetOwnerDocumentsetReadOnlysetTextContentsynchronizeChildren

Field Detail

baseURIback to summary
protected String baseURI

base uri

encodingback to summary
protected String encoding

Encoding

inputEncodingback to summary
protected String inputEncoding

Input Encoding

nameback to summary
protected String name

Entity name.

notationNameback to summary
protected String notationName

Notation name.

publicIdback to summary
protected String publicId

Public identifier.

serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides com.sun.org.apache.xerces.internal.dom.ParentNode.serialVersionUID.

Serialization version.

systemIdback to summary
protected String systemId

System identifier.

versionback to summary
protected String version

Version

Constructor Detail

EntityImplback to summary
public EntityImpl(CoreDocumentImpl ownerDoc, String name)

Factory constructor.

Method Detail

cloneNodeback to summary
public Node cloneNode(boolean deep)

Overrides com.sun.org.apache.xerces.internal.dom.ParentNode.cloneNode.

Implements org.w3c.dom.Node.cloneNode.

Clone node.

Parameters
deep:boolean

Doc from org.w3c.dom.Node.cloneNode.

If true, recursively clone the subtree under the specified node; if false, clone only the node itself (and its attributes, if it is an Element).

Returns:Node

Doc from org.w3c.dom.Node.cloneNode.

The duplicate node.

getBaseURIback to summary
public String getBaseURI()

Overrides com.sun.org.apache.xerces.internal.dom.NodeImpl.getBaseURI.

Implements org.w3c.dom.Node.getBaseURI.

Returns the absolute base URI of this node or null if the implementation wasn't able to obtain an absolute URI.

Note

If the URI is malformed, a null is returned.

Returns:String

The absolute base URI of this node or null.

Since
DOM Level 3
getInputEncodingback to summary
public String getInputEncoding()

Implements org.w3c.dom.Entity.getInputEncoding.

An attribute specifying the encoding used for this entity at the tiome 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..

Since
DOM Level 3
getNodeNameback to summary
public String getNodeName()

Implements abstract com.sun.org.apache.xerces.internal.dom.NodeImpl.getNodeName.

Implements org.w3c.dom.Node.getNodeName.

Returns the entity name

getNodeTypeback to summary
public short getNodeType()

Implements abstract com.sun.org.apache.xerces.internal.dom.NodeImpl.getNodeType.

Implements org.w3c.dom.Node.getNodeType.

A short integer indicating what type of node this is. The named constants for this value are defined in the org.w3c.dom.Node interface.

getNotationNameback to summary
public String getNotationName()

Implements org.w3c.dom.Entity.getNotationName.

Unparsed entities -- which contain non-XML data -- have a "notation name" which tells applications how to deal with them. Parsed entities, which are in XML format, don't need this and set it to null.

getPublicIdback to summary
public String getPublicId()

Implements org.w3c.dom.Entity.getPublicId.

The public identifier associated with the entity. If not specified, this will be null.

getSystemIdback to summary
public String getSystemId()

Implements org.w3c.dom.Entity.getSystemId.

The system identifier associated with the entity. If not specified, this will be null.

getXmlEncodingback to summary
public String getXmlEncoding()

Implements org.w3c.dom.Entity.getXmlEncoding.

DOM Level 3 WD - experimental the encoding of this entity, when it is an external parsed entity.

getXmlVersionback to summary
public String getXmlVersion()

Implements org.w3c.dom.Entity.getXmlVersion.

DOM Level 3 WD - experimental the version number of this entity, when it is an external parsed entity.

setBaseURIback to summary
public void setBaseURI(String uri)

NON-DOM: set base uri

setInputEncodingback to summary
public void setInputEncoding(String inputEncoding)

NON-DOM, used to set the input encoding.

setNodeValueback to summary
public void setNodeValue(String x) throws DOMException

Overrides com.sun.org.apache.xerces.internal.dom.NodeImpl.setNodeValue.

Implements org.w3c.dom.Node.setNodeValue.

Sets the node value.

Exceptions
DOMException:

Doc from org.w3c.dom.Node.setNodeValue.

NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly and if it is not defined to be null.

setNotationNameback to summary
public void setNotationName(String name)

DOM Level 2: Unparsed entities -- which contain non-XML data -- have a "notation name" which tells applications how to deal with them. Parsed entities, which are in XML format, don't need this and set it to null.

setPrefixback to summary
public void setPrefix(String prefix) throws DOMException

Overrides com.sun.org.apache.xerces.internal.dom.NodeImpl.setPrefix.

Implements org.w3c.dom.Node.setPrefix.

The namespace prefix of this node

Exceptions
DOMException:

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
setPublicIdback to summary
public void setPublicId(String id)

DOM Level 2: The public identifier associated with the entity. If not specified, this will be null.

setSystemIdback to summary
public void setSystemId(String id)

DOM Level 2: The system identifier associated with the entity. If not specified, this will be null.

setXmlEncodingback to summary
public void setXmlEncoding(String value)

NON-DOM encoding - 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

setXmlVersionback to summary
public void setXmlVersion(String value)

NON-DOM version - 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