public static void prependChild(Element parent,Element child){
  Node first=parent.getFirstChild();
  if (first == null)   parent.appendChild(child);
 else {
    parent.insertBefore(child,first);
  }
}

public static void prependChild ( Element parent , Element child ) { Node first = parent . getFirstChild ( ) ; if ( first == null ) parent . appendChild ( child ) ; else { parent . insertBefore ( child , first ) ; } }
adds a child at the first place
