FileDocCategorySizeDatePackage
DeferredElementImpl.javaAPI DocApache Xerces 3.0.14481Fri Sep 14 20:33:52 BST 2007org.apache.xerces.dom

DeferredElementImpl

public class DeferredElementImpl extends ElementImpl implements DeferredNode
Elements represent most of the "markup" and structure of the document. They contain both the data for the element itself (element name and attributes), and any contained nodes, including document text (as children).

Elements may have Attributes associated with them; the API for this is defined in Node, but the function is implemented here. In general, XML applications should retrive Attributes as Nodes, since they may contain entity references and hence be a fairly complex sub-tree. HTML users will be dealing with simple string values, and convenience methods are provided to work in terms of Strings.

DeferredElementImpl inherits from ElementImpl which does not support Namespaces. DeferredElementNSImpl, which inherits from ElementNSImpl, does.

see
DeferredElementNSImpl
xerces.internal
version
$Id: DeferredElementImpl.java 447266 2006-09-18 05:57:49Z mrglavas $
since
PR-DOM-Level-1-19980818.

Fields Summary
static final long
serialVersionUID
Serialization version.
protected transient int
fNodeIndex
Node index.
Constructors Summary
DeferredElementImpl(DeferredDocumentImpl ownerDoc, int nodeIndex)
This is the deferred constructor. Only the fNodeIndex is given here. All other data, can be requested from the ownerDocument via the index.


    //
    // Constructors
    //

                                
        
        super(ownerDoc, null);

        fNodeIndex = nodeIndex;
        needsSyncChildren(true);

    
Methods Summary
public final intgetNodeIndex()
Returns the node index.

        return fNodeIndex;
    
protected final voidsynchronizeChildren()

        DeferredDocumentImpl ownerDocument =
            (DeferredDocumentImpl) ownerDocument();
        ownerDocument.synchronizeChildren(this, fNodeIndex);
    
protected final voidsynchronizeData()
Synchronizes the data (name and value) for fast nodes.


        // no need to sync in the future
        needsSyncData(false);

        // fluff data
        DeferredDocumentImpl ownerDocument =
            (DeferredDocumentImpl)this.ownerDocument;

        // we don't want to generate any event for this so turn them off
        boolean orig = ownerDocument.mutationEvents;
        ownerDocument.mutationEvents = false;

        name = ownerDocument.getNodeName(fNodeIndex);

        // attributes
        setupDefaultAttributes();
        int index = ownerDocument.getNodeExtra(fNodeIndex);
        if (index != -1) {
            NamedNodeMap attrs = getAttributes();
            do {
                NodeImpl attr = (NodeImpl)ownerDocument.getNodeObject(index);
                attrs.setNamedItem(attr);
                index = ownerDocument.getPrevSibling(index);
            } while (index != -1);
        }

        // set mutation events flag back to its original value
        ownerDocument.mutationEvents = orig;