Java XML Document Clone copyChildren(Element from, Element to, Document doc)

Here you can find the source of copyChildren(Element from, Element to, Document doc)

Description

copy Children

License

Open Source License

Declaration

public static void copyChildren(Element from, Element to, Document doc) 

Method Source Code

//package com.java2s;

import org.w3c.dom.Node;

import org.w3c.dom.Element;
import org.w3c.dom.Document;

public class Main {
    public static void copyChildren(Element from, Element to, Document doc) {
        Node child = from.getFirstChild();
        while (child != null) {
            to.appendChild(doc.importNode(child, /*deep*/ true));

            child = child.getNextSibling();
        }/*  w w  w .  ja v a  2s. co m*/
    }
}

Related

  1. cloneDOM(Node node, Document document)
  2. cloneNode(Document d, Node n)
  3. cloneNode(Document document, Node node, boolean deep)
  4. copy(Document from, Document to)
  5. copyChildren(Document new_doc, Node node, Node new_node)
  6. copyChildren(final Document newDoc, final Node node, final Node newNode)
  7. copyDocument(Document document)
  8. copyDocument(Document from, Document to)
  9. copyDocument(Document oldDocument, Document newDocument)