DeferredElementNSImpl.javaAPI DocJava SE 5 API6351Fri Aug 26 14:55:44 BST


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

Fields Summary
static final long
Serialization version.
protected transient int
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;

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

        // 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 = ownerDocument.getTypeInfo(fNodeIndex);

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

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