public Node replaceNode ( Node n ) { if ( parent ( ) == null ) { throw new UnsupportedOperationException ( "Replacing the root node is not supported" ) ; } List tail = getTail ( ) ; parent ( ) . appendNode ( n . name ( ) , n . attributes ( ) , n . value ( ) ) ; parent ( ) . children ( ) . addAll ( tail ) ; getParentList ( parent ( ) ) . remove ( this ) ; this . setParent ( null ) ; return this ; }
Replaces the current node with the supplied node .