final String path = getPath();
final String path = getPath().toString();
	public Node replaceChild(Node newChild, Node oldChild) throws DOMException {		if (!(oldChild instanceof NodeImpl))			throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, "wrong node type");		NodeImpl old = (NodeImpl) oldChild;		if (old.getParentGID() != gid)			throw new DOMException(				DOMException.NOT_FOUND_ERR,				"node is not a child of this element");		final DocumentImpl prevDoc = new DocumentImpl(ownerDocument);		NodeImpl previous = (NodeImpl) old.getPreviousSibling();		if (previous == null)			previous = this;		else			previous = getLastNode(previous);		final String path = getPath();		ownerDocument.broker.removeNode(old, path);		ownerDocument.broker.endRemove();		appendChild(old.gid, previous, newChild, true);		// reindex if required		ownerDocument.broker.reindex(prevDoc, ownerDocument, null);		try {			ownerDocument.broker.saveCollection(ownerDocument.getCollection());		} catch (PermissionDeniedException e) {			throw new DOMException(DOMException.INVALID_ACCESS_ERR, e.getMessage());		}		return newChild;	}