code: public void removeChildNode() throws ChildNodeException {
      Node parentLast;
      Node thisLast;
  
      // Add this nodes children to the end of the Parents children list
      if (!isLeaf() && hasParent()) {
        parentLast = getParentNode().getFirstChild().getPrevSibling();
        thisLast = getFirstChild().getPrevSibling();
  
        // add the first child to the end of the parent list
        parentLast.setNextSibling(getFirstChild());
  
        //point the last child to the start of the parent list
        thisLast.setNextSibling(getParentNode().getFirstChild());
  
        // Now remove self
        getParentNode().removeChild(this);
      }
    }
docs: Remove just this node from the tree. The children of this node get attached to the parent.