Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import org.w3c.dom.Document;

import org.w3c.dom.Node;

public class Main {
    public static Node insertNewAfter(final Document impD, final Node targetE, final Node newE) {
        Node impNewNode = impD.importNode(newE, true);
        Node parent = targetE.getParentNode();
        if (targetE.getNextSibling() == null) {
            parent.appendChild(impNewNode);
        } else {
            parent.insertBefore(impNewNode, targetE.getNextSibling());
        }
        return impNewNode;
    }
}