title: How can I copy an node to a different Document without the DOMException?
body: <p>In My App, I want to copy a node from one document to another .</p>
  
  <p>Here is the code.</p>
  
  <pre><code>Element entryElement, operationElement;
  for (int i = 0; i &lt; eventList.getLength(); i++) {
      entryElement = (Element) eventList.item(i);
      gsTag = entryElement.getAttribute("gs_tag");
      System.out.println(gsTag);
      if (gsTag.equals("insert") || gsTag.equals("update") || gsTag.equals("delete")) {
          entryElement =  (Element) entryElement.cloneNode(true);
          rootElement.appendChild(entryElement);
          operationElement = syncDom.createElement("batch:operation");
          entryElement.appendChild(operationElement);
          operationElement.setAttribute("type", gsTag);
      }
  }
  </code></pre>
  
  <p>when doing <code>rootElement.appendChild(entryElement);</code> the domexception occurs , and I checked the exception's code is 4. In java API , this code means one element can only belong to one document, but I did already clone the node. Why did it happen?</p>