public ElemTemplateElement replaceChild(ElemTemplateElement newChildElem,ElemTemplateElement oldChildElem){
  if (oldChildElem == null || oldChildElem.getParentElem() != this)   return null;
  ElemTemplateElement prev=oldChildElem.getPreviousSiblingElem();
  if (null != prev)   prev.m_nextSibling=newChildElem;
  if (m_firstChild == oldChildElem)   m_firstChild=newChildElem;
  newChildElem.m_parentNode=this;
  oldChildElem.m_parentNode=null;
  newChildElem.m_nextSibling=oldChildElem.m_nextSibling;
  oldChildElem.m_nextSibling=null;
  return newChildElem;
}

public ElemTemplateElement replaceChild ( ElemTemplateElement newChildElem , ElemTemplateElement oldChildElem ) { if ( oldChildElem == null || oldChildElem . getParentElem ( ) != this ) return null ; ElemTemplateElement prev = oldChildElem . getPreviousSiblingElem ( ) ; if ( null != prev ) prev . m_nextSibling = newChildElem ; if ( m_firstChild == oldChildElem ) m_firstChild = newChildElem ; newChildElem . m_parentNode = this ; oldChildElem . m_parentNode = null ; newChildElem . m_nextSibling = oldChildElem . m_nextSibling ; oldChildElem . m_nextSibling = null ; return newChildElem ; }
replace the old child with a new child .
