Here you can find the source of replaceNode(Node oldNode, Node newNode, Node source)
public static void replaceNode(Node oldNode, Node newNode, Node source)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Node; public class Main { public static void replaceNode(Node oldNode, Node newNode, Node source) { source.replaceChild(newNode, oldNode); }//from w w w . ja v a 2 s . c o m }