return result;
return refChild.getPreviousSibling();
    public Node insertBefore(Node newChild, Node refChild) throws DOMException {        if (refChild == null)            return appendChild(newChild);        if (!(refChild instanceof StoredNode))            throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, "wrong node type");        final StoredNode ref = (StoredNode) refChild;        final long first = firstChildID();        if (ref.getGID() < first || ref.getGID() > ref.getGID() + children - 1)            throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,                    "reference node is not a child of the selected node");        Node result;        try {            TransactionManager transact = getBroker().getBrokerPool().getTransactionManager();            Txn transaction = transact.beginTransaction();            if (ref.getGID() == first)                result = appendChild(null, null, first, new NodeImplRef(this), getPath(), newChild, false);            else {                StoredNode prev = (StoredNode) ref.getPreviousSibling();                result = appendChild(null, null, ref.getGID(), new NodeImplRef(getLastNode(prev)), getPath(), newChild, false);            }            getBroker().updateNode(null, this);            final DocumentImpl owner = (DocumentImpl)getOwnerDocument();            getBroker().reindexXMLResource(null, owner, owner, null);            getBroker().storeXMLResource(null, owner);            transact.commit(transaction);            return result;        } catch(TransactionException e) {            //TODO : rollback ? -pb            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, e.getMessage());        }    }