FileDocCategorySizeDatePackage
DeferredElementDefinitionImpl.javaAPI DocApache Xerces 3.0.13916Fri Sep 14 20:33:52 BST 2007org.apache.xerces.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.

xerces.internal
version
$Id: DeferredElementDefinitionImpl.java 447266 2006-09-18 05:57:49Z mrglavas $

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);