DocumentImpl prevDoc = new DocumentImpl(ownerDocument); Node node = null; NodeImpl lastAttrib = checkDupAttributes(attribs); if (children == 0) {  node = appendChildren(firstChildID(), this, getPath(), attribs, true); } else { if (lastAttrib != null && lastAttrib.gid == lastChildID()) node = appendChildren(lastChildID() + 1, lastAttrib, getPath(), attribs, true); else node = appendChildren(firstChildID() + 1, this, getPath(), attribs, true); } ownerDocument.broker.update(this); ownerDocument.broker.reindex(prevDoc, ownerDocument, null); return node;
NodeList duplicateAttrs = findDupAttributes(attribs); if(duplicateAttrs != null) { removeAppendAttributes(duplicateAttrs, attribs); return null; } else { DocumentImpl prevDoc = new DocumentImpl(ownerDocument); Node node = null; NodeImpl lastAttrib = getLastAttribute(); if (children == 0) {  node = appendChildren(firstChildID(), this, getPath(), attribs, true); } else { if (lastAttrib != null && lastAttrib.gid == lastChildID()) node = appendChildren(lastChildID() + 1, lastAttrib, getPath(), attribs, true); else node = appendChildren(firstChildID() + 1, this, getPath(), attribs, true); } ownerDocument.broker.update(this); ownerDocument.broker.reindex(prevDoc, ownerDocument, null); return node; }
    public Node appendAttributes(NodeList attribs)            throws DOMException {        DocumentImpl prevDoc = new DocumentImpl(ownerDocument);        Node node = null;        NodeImpl lastAttrib = checkDupAttributes(attribs);        if (children == 0) {            // no children: append a new child            node = appendChildren(firstChildID(), this, getPath(), attribs, true);        }        else {            if (lastAttrib != null && lastAttrib.gid == lastChildID())                node = appendChildren(lastChildID() + 1, lastAttrib, getPath(), attribs, true);            else                node = appendChildren(firstChildID() + 1, this, getPath(), attribs, true);        }        ownerDocument.broker.update(this);        ownerDocument.broker.reindex(prevDoc, ownerDocument, null);        return node;    }