FileDocCategorySizeDatePackage
DeferredElementImpl.javaAPI DocJava SE 5 API6294Fri Aug 26 14:55:44 BST 2005com.sun.org.apache.xerces.internal.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
version
$Id: DeferredElementImpl.java,v 1.2 2003/11/18 00:22:50 kk122374 Exp $
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);
        type = ownerDocument.getTypeInfo(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;