org.apache.xerces.dom

Class DeferredEntityImpl

Implemented Interfaces:
Cloneable, DeferredNode, Entity, EventTarget, Node, NodeList, Serializable

public class DeferredEntityImpl
extends EntityImpl
implements DeferredNode

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.
Version:
$Id: DeferredEntityImpl.java,v 1.19 2004/10/05 17:12:51 mrglavas Exp $
Since:
PR-DOM-Level-1-19980818.

Field Summary

protected int
fNodeIndex
Node index.

Fields inherited from class org.apache.xerces.dom.EntityImpl

baseURI, encoding, inputEncoding, name, notationName, publicId, systemId, version

Fields inherited from class org.apache.xerces.dom.ParentNode

fNodeListCache, firstChild, ownerDocument

Fields inherited from class org.apache.xerces.dom.ChildNode

nextSibling, previousSibling

Fields inherited from class org.apache.xerces.dom.NodeImpl

DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_IS_CONTAINED, DOCUMENT_POSITION_PRECEDING, ELEMENT_DEFINITION_NODE, FIRSTCHILD, HASSTRING, ID, IGNORABLEWS, NORMALIZED, OWNED, READONLY, SPECIFIED, SYNCCHILDREN, SYNCDATA, TREE_POSITION_ANCESTOR, TREE_POSITION_DESCENDANT, TREE_POSITION_DISCONNECTED, TREE_POSITION_EQUIVALENT, TREE_POSITION_FOLLOWING, TREE_POSITION_PRECEDING, TREE_POSITION_SAME_NODE, flags, ownerNode

Fields inherited from interface org.apache.xerces.dom.DeferredNode

TYPE_NODE

Method Summary

int
getNodeIndex()
Returns the node index.
protected void
synchronizeChildren()
Synchronize the children.
protected void
synchronizeData()
Synchronize the entity data.

Methods inherited from class org.apache.xerces.dom.EntityImpl

cloneNode, getBaseURI, getInputEncoding, getNodeName, getNodeType, getNotationName, getPublicId, getSystemId, getXmlEncoding, getXmlVersion, setBaseURI, setInputEncoding, setNotationName, setPublicId, setSystemId, setXmlEncoding, setXmlVersion

Methods inherited from class org.apache.xerces.dom.ParentNode

cloneNode, getChildNodes, getChildNodesUnoptimized, getFirstChild, getLastChild, getLength, getOwnerDocument, getTextContent, hasChildNodes, insertBefore, isEqualNode, item, normalize, removeChild, replaceChild, setReadOnly, setTextContent, synchronizeChildren

Methods inherited from class org.apache.xerces.dom.ChildNode

cloneNode, getNextSibling, getParentNode, getPreviousSibling

Methods inherited from class org.apache.xerces.dom.NodeImpl

addEventListener, appendChild, changed, changes, cloneNode, compareDocumentPosition, compareTreePosition, dispatchEvent, getAttributes, getBaseURI, getChildNodes, getContainer, getFeature, getFirstChild, getLastChild, getLength, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeNumber, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getReadOnly, getTextContent, getUserData, getUserData, getUserDataRecord, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, item, lookupNamespaceURI, lookupPrefix, needsSyncChildren, normalize, removeChild, removeEventListener, replaceChild, setNodeValue, setPrefix, setReadOnly, setTextContent, setUserData, setUserData, synchronizeData, toString

Field Details

fNodeIndex

protected int fNodeIndex
Node index.

Method Details

getNodeIndex

public int getNodeIndex()
Returns the node index.
Specified by:
getNodeIndex in interface DeferredNode

synchronizeChildren

protected void synchronizeChildren()
Synchronize the children.
Overrides:
synchronizeChildren in interface ParentNode

synchronizeData

protected void synchronizeData()
Synchronize the entity data. This is special because of the way that the "fast" version stores the information.
Overrides:
synchronizeData in interface NodeImpl

Copyright B) 1999-2005 Apache XML Project. All Rights Reserved.