Java XML Node Replace replaceWith(Node currentNode, Node replacerNode)

Here you can find the source of replaceWith(Node currentNode, Node replacerNode)

Description

replace With

License

Open Source License

Declaration

public static void replaceWith(Node currentNode, Node replacerNode) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Educational Online Test Delivery System Copyright (c) 2014 American
 * Institutes for Research//w w  w.  j a  v  a 2s.  c o m
 * 
 * Distributed under the AIR Open Source License, Version 1.0 See accompanying
 * file AIR-License-1_0.txt or at http://www.smarterapp.org/documents/
 * American_Institutes_for_Research_Open_Source_Software_License.pdf
 ******************************************************************************/

import org.w3c.dom.Node;

public class Main {
    public static void replaceWith(Node currentNode, Node replacerNode) {
        currentNode.getParentNode().replaceChild(replacerNode, currentNode);
    }
}

Related

  1. replaceNode(Node masterNode, Node oldNode, Node newNode)
  2. replaceNode(Node oldNode, Node newNode, Node source)
  3. replaceText(Node node, String text)
  4. replaceVariable(final Node node, final String sVar, final String sValue)
  5. replaceVariable(final Node node, final String var, final String valueString)
  6. replaceWith(Node oldNode, Node newNode)