FileDocCategorySizeDatePackage
DeferredElementNSImpl.javaAPI DocJava SE 6 API4191Tue Jun 10 00:22:36 BST 2008com.sun.org.apache.xerces.internal.dom

DeferredElementNSImpl

public class DeferredElementNSImpl extends ElementNSImpl implements DeferredNode
DeferredElementNSImpl is to ElementNSImpl, what DeferredElementImpl is to ElementImpl.
xerces.internal
see
DeferredElementImpl

Fields Summary
static final long
serialVersionUID
Serialization version.
protected transient int
fNodeIndex
Node index.
Constructors Summary
DeferredElementNSImpl(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()
Synchronizes the node's children with the internal structure. Fluffing the children at once solves a lot of work to keep the two structures in sync. The problem gets worse when editing the tree -- this makes it a lot easier.

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

        // extract local part from QName
        int index = name.indexOf(':");
        if (index < 0) {
            localName = name;
        } 
        else {
            localName = name.substring(index + 1);
        }

	    namespaceURI = ownerDocument.getNodeURI(fNodeIndex);
        type = (XSTypeDefinition)ownerDocument.getTypeInfo(fNodeIndex);

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

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