code: @Override
      public void remove() throws TTException {
          checkState(!mDelegate.isClosed(), "Transaction is already closed.");
          checkState(mDelegate.getCurrentNode().getKind() != IConstants.ROOT,
              "Document root can not be removed.");
          if (mDelegate.getCurrentNode() instanceof ITreeStructData) {
              final ITreeStructData node = (ITreeStructData)mDelegate.getCurrentNode();
              if (node.getKind() == IConstants.ELEMENT) {
                  long currentKey = node.getDataKey();
                  ElementNode element = (ElementNode)node;
                  for (int i = 0; i < element.getAttributeCount(); i++) {
                      moveTo(element.getAttributeKey(i));
                      getPtx().removeData(mDelegate.getCurrentNode());
                  }
                  for (int i = 0; i < element.getNamespaceCount(); i++) {
                      moveTo(element.getNamespaceKey(i));
                      getPtx().removeData(mDelegate.getCurrentNode());
                  }
                  moveTo(currentKey);
              }
              moveTo(node.getDataKey());
              adaptForRemove(node);
              adaptHashesWithRemove();
  
              // Set current node.
              if (node.hasRightSibling()) {
                  moveTo(node.getRightSiblingKey());
              } else if (node.hasLeftSibling()) {
                  moveTo(node.getLeftSiblingKey());
              } else {
                  moveTo(node.getParentKey());
              }
          } else if (mDelegate.getCurrentNode().getKind() == IConstants.ATTRIBUTE) {
              final ITreeData treeData = mDelegate.getCurrentNode();
  
              final ElementNode parentNode = (ElementNode)getPtx().getData(treeData.getParentKey());
              parentNode.removeAttribute(treeData.getDataKey());
              getPtx().setData(parentNode);
              adaptHashesWithRemove();
              moveTo(mDelegate.getCurrentNode().getParentKey());
          } else if (mDelegate.getCurrentNode().getKind() == IConstants.NAMESPACE) {
              final ITreeData treeData = mDelegate.getCurrentNode();
              final ElementNode parentNode = (ElementNode)getPtx().getData(treeData.getParentKey());
              parentNode.removeNamespace(treeData.getDataKey());
              getPtx().setData(parentNode);
              adaptHashesWithRemove();
              moveTo(mDelegate.getCurrentNode().getParentKey());
          }
      }
docs: {@inheritDoc}