FileDocCategorySizeDatePackage
DeferredElementDefinitionImpl.javaAPI DocJava SE 5 API5683Fri Aug 26 14:55:42 BST 2005com.sun.org.apache.xerces.internal.dom

DeferredElementDefinitionImpl

public class DeferredElementDefinitionImpl extends ElementDefinitionImpl implements DeferredNode
NON-DOM CLASS: Describe one of the Elements (and its associated Attributes) defined in this Document Type.

I've included this in Level 1 purely as an anchor point for default attributes. In Level 2 it should enable the ChildRule support.

version
$Id: DeferredElementDefinitionImpl.java,v 1.12 2002/01/29 01:15:07 lehors Exp $

Fields Summary
static final long
serialVersionUID
Serialization version.
protected transient int
fNodeIndex
Node index.
Constructors Summary
DeferredElementDefinitionImpl(DeferredDocumentImpl ownerDocument, 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(ownerDocument, null);
        
        fNodeIndex = nodeIndex;
        needsSyncData(true);
        needsSyncChildren(true);

    
Methods Summary
public intgetNodeIndex()
Returns the node index.

        return fNodeIndex;
    
protected voidsynchronizeChildren()
Synchronizes the default attribute values.


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

        // attributes are now synced
        needsSyncChildren(false);

        // create attributes node map
        DeferredDocumentImpl ownerDocument =
            (DeferredDocumentImpl)this.ownerDocument;
        attributes = new NamedNodeMapImpl(ownerDocument);

        // Default attributes dangle as children of the element
        // definition "node" in the internal fast table.
        for (int nodeIndex = ownerDocument.getLastChild(fNodeIndex);
             nodeIndex != -1;
             nodeIndex = ownerDocument.getPrevSibling(nodeIndex)) {
            Node attr = ownerDocument.getNodeObject(nodeIndex);
            attributes.setNamedItem(attr);
        }

        // set mutation events flag back to its original value
        ownerDocument.setMutationEvents(orig);

    
protected 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;
        name = ownerDocument.getNodeName(fNodeIndex);