code: private static void copyHeader(
  		final Document doc,
  		final Document ndoc) {
  		NodeList headnl = doc.getElementsByTagName("head");
  
  		if (headnl.getLength() > 0) {
  			Element head = (Element) headnl.item(0);
  			ndoc.getDocumentElement()
  					.insertBefore(ndoc.adoptNode(head.cloneNode(true)),
  					ndoc.getDocumentElement().getFirstChild());
  		} // end if
  	}
docs: Copy the html header from doc to ndoc
  
  @param doc source of html header
  @param ndoc destination