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);
    }
  }
public void removeChildNode ( ) throws ChildNodeException { Node parentLast ; Node thisLast ; if ( ! isLeaf ( ) && hasParent ( ) ) { parentLast = getParentNode ( ) . getFirstChild ( ) . getPrevSibling ( ) ; thisLast = getFirstChild ( ) . getPrevSibling ( ) ; parentLast . setNextSibling ( getFirstChild ( ) ) ; thisLast . setNextSibling ( getParentNode ( ) . getFirstChild ( ) ) ; getParentNode ( ) . removeChild ( this ) ; } }
Remove just this node from the tree. The children of this node get attached to the parent.