When using Document a Element can only be appended with a Node, but what if we have a Element ?
Easy, Element extends Node so just pass the Element along and all is well
import org.w3c.dom.Document; import org.w3c.dom.Element; Document doc; Element newElement; Element oldElement; //code to find that newElement = doc.createElement("tag"); oldElement.appendChild(newElement); |