public void replaceChild(Element oldChild,Element newChild){
  if (children != null) {
    setChildParent(newChild);
    int index=children.indexOf(oldChild);
    if (index != -1) {
      children.add(index,newChild);
      removeChildAt(index + 1);
      return;
    }
  }
  throw new IllegalArgumentException("The oldChild element specified must be this element's child");
}

public void replaceChild ( Element oldChild , Element newChild ) { if ( children != null ) { setChildParent ( newChild ) ; int index = children . indexOf ( oldChild ) ; if ( index != - 1 ) { children . add ( index , newChild ) ; removeChildAt ( index + 1 ) ; return ; } } throw new IllegalArgumentException ( "The oldChild element specified must be this element's child" ) ; }
replaces one child with another
